LogoNotyra Docs
Plugins

Lifecycle

Per-window activation, stopping and resource cleanup

A feature ESM module may export activate() and deactivate(). Register extensions during activation and release your timers, connections and DOM resources during deactivation. See the complete template.

Execution windows

The main window and each note window have their own PluginHost and JavaScript environment. Enabled, compatible and consented plugins activate separately in each. The settings window does not execute plugin code. Module variables are not shared storage between windows; commands and subscriptions are also per-window.

Plugins load in installed order. Updating or reloading a development plugin changes version/generation, stopping the old session before loading the new one.

Deadlines and errors

activate(), deactivate() and host-invoked commands have 10-second timeouts. Synchronous throws and rejected promises are failures too. Activation failure rolls back registrations, disables the plugin and reports an error. deactivate() is not called if activation never completed.

Stopping continues cleanup even if deactivation throws or times out. The host removes session-owned CSS, themes, panels, Markdown/editor extensions, commands, toolbar buttons, keymaps and subscriptions. It cannot forcibly terminate arbitrary JavaScript or an unfinished promise: cancel your own timers and requests too.

Panel rendering

render(container) runs when a view becomes visible. Its returned cleanup function runs on tab changes, hiding the panel or stopping the plugin. Showing it again calls render again, so do not rely on the old container. Synchronous render errors are isolated inside the panel; custom asynchronous work started after render is outside that catch boundary.

Avoid network or user-interaction waits in activation. Move work into commands. The note and network examples have no operation side effects during activation.