Skip to main content

NanoForge


npm versionnpm downloadsTests statusLast commitContributors

About

@nanoforge-dev/editor-lib is the bridge between a running NanoForge application and an external editor host. EditorLibrary turns the raw toEditor/fromEditor event-emitter pair supplied via RunOptions.editor into the Context.editor facade every other library sees, and handles the pause/resume/step/stop commands, run state reports, frame stats and log forwarding: see the editor protocol. It also provides QueuedEventEmitter, the event emitter an editor host gives a game in RunOptions.editor.

Installation

Node.js 26 or newer is required.

Example usage

Register EditorLibrary alongside your other libraries. It does nothing when no editor started the app:
The editor host constructs one QueuedEventEmitter per direction and hands both to RunOptions.editor:
Libraries talk to the editor through Context.editor, undefined when no editor started the game:
One-time editor wiring goes in __editorInit, which EditorLibrary calls once on every library that has it, when the editor’s welcome arrives:

Contributing

Before creating an issue, please ensure that it hasn’t already been reported/suggested, and double-check the documentation.
See the contribution guide if you’d like to submit a PR.

Help

If you don’t understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don’t hesitate to ask questions in discussions.

Enumerations

Classes

Interfaces

Type Aliases

Variables