> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nanoforge.eu/llms.txt
> Use this file to discover all available pages before exploring further.

# EditorLibrary

> Editor bridge library.

Defined in: [modules/editor/src/editor-library.ts:19](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L19)

Editor bridge library.

## Remarks

Register it (`app.use(new EditorLibrary())`) in a game that may be started
by an editor host. When `RunOptions.editor` is given, it handles the base
commands (pause, resume, step, stop), reports the run state, provides
`Context.editor` and the features the editor asks for in its `welcome`
(frame stats, console output). Without `RunOptions.editor` it does nothing.

Once the editor's `welcome` arrives, it calls `__editorInit(ctx)` on every
registered library that has it (see `EditorAwareLibrary`).

## Extends

* `Library`

## Constructors

### Constructor

> **new EditorLibrary**(): `EditorLibrary`

Defined in: [modules/editor/src/editor-library.ts:25](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L25)

#### Returns

`EditorLibrary`

#### Overrides

`Library.constructor`

## Properties

### key

> `readonly` **key**: `"editor"`

Defined in: [modules/editor/src/editor-library.ts:20](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L20)

This library's identity: its slot on `Context`, its registry key, and
the identifier used to reference it in ordering relationships.

#### Overrides

`Library.key`

## Accessors

### relationships

#### Get Signature

> **get** **relationships**(): `LibraryRelationships`

Defined in: packages/common/dist/index.d.ts:512

**`Internal`**

##### Returns

`LibraryRelationships`

#### Inherited from

`Library.relationships`

## Methods

### \_\_clear()

> **\_\_clear**(`_ctx`): `Promise`\<`void`>

Defined in: packages/common/dist/index.d.ts:525

Called once after the tick loop stops.

#### Parameters

##### \_ctx

[`Context`](https://docs.nanoforge.eu/references/engine/3.0.0/ecs/index/interfaces/Context)

#### Returns

`Promise`\<`void`>

#### Inherited from

`Library.__clear`

***

### \_\_events()

> **\_\_events**(`ctx`): `Promise`\<`void`>

Defined in: [modules/editor/src/editor-library.ts:40](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L40)

Drains the editor's commands every tick — in `__events`, so also while
paused (the `resume` command has to get through) — and runs the
libraries' `__editorInit` once the editor's `welcome` arrived.

#### Parameters

##### ctx

[`Context`](https://docs.nanoforge.eu/references/engine/3.0.0/ecs/index/interfaces/Context)

#### Returns

`Promise`\<`void`>

#### Overrides

`Library.__events`

***

### \_\_init()

> **\_\_init**(`ctx`): `Promise`\<`void`>

Defined in: [modules/editor/src/editor-library.ts:30](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L30)

Called once, in dependency order, before the tick loop starts.

#### Parameters

##### ctx

`InitContext`

#### Returns

`Promise`\<`void`>

#### Overrides

`Library.__init`

***

### \_\_run()

> **\_\_run**(`_ctx`): `Promise`\<`void`>

Defined in: packages/common/dist/index.d.ts:523

Called every tick, in run order, while the tick loop is active and not paused.

#### Parameters

##### \_ctx

[`Context`](https://docs.nanoforge.eu/references/engine/3.0.0/ecs/index/interfaces/Context)

#### Returns

`Promise`\<`void`>

#### Inherited from

`Library.__run`

***

### expose()

> **expose**(): [`EditorContextApi`](https://docs.nanoforge.eu/references/engine/3.0.0/editor-lib/interfaces/EditorContextApi) | `undefined`

Defined in: [modules/editor/src/editor-library.ts:47](https://github.com/NanoForge-dev/Engine/blob/ed8c7e0b33d17f8343c32659cf63ba4166a4fa53/modules/editor/src/editor-library.ts#L47)

Returns this library's public contribution to `Context[this.key]`.

#### Returns

[`EditorContextApi`](https://docs.nanoforge.eu/references/engine/3.0.0/editor-lib/interfaces/EditorContextApi) | `undefined`

#### Remarks

Return a plain object exposing only what game code should be able to
reach — never `this` — so internal state and lifecycle hooks never leak
onto `Context`. Libraries with nothing to expose (headless libraries)
can leave this unimplemented; they simply won't appear on `Context`.

#### Overrides

`Library.expose`

***

### throwNotInitializedError()

> `protected` **throwNotInitializedError**(): `never`

Defined in: packages/common/dist/index.d.ts:536

#### Returns

`never`

#### Inherited from

`Library.throwNotInitializedError`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.