Skip to main content

Overview

api.registry provides low-level access to the plugin registry. Primarily used by the Plugin Manager.

Registry Methods

registry.getAll()

Returns a deep copy of the registry array.
Returns: Array<PluginDefinition>

registry.get(id)

Returns a single plugin definition by ID (shallow copy), or null if not found.
Returns: PluginDefinition | null

registry.save(newRegistry)

Overwrites the entire registry and persists to localStorage.

Management Methods

These are attached directly to api (not api.registry):

api.installPlugin(id, url, name)

Install a plugin from URL. Validates the URL format and checks for duplicate IDs.
Returns: Promise<boolean>true if installed, false if ID already exists
Plugins installed via installPlugin get source: 'manual'. The core will show a warning notification when loading manual plugins.

api.togglePlugin(id)

Enable or disable a plugin. Loads the plugin if disabled, unloads if enabled.
Returns: Promise<boolean>true if successful, false if not found

api.deletePlugin(id)

Permanently remove a plugin. Unloads it first, then removes from registry.
Returns: booleantrue if successful, false if not found

api.reloadPlugin(id)

Unload and reload a single plugin without restarting the whole board.
Returns: Promise<boolean>true if successful, false if not found
Use reloadPlugin during plugin development to test changes without restarting the entire board.

api.restart()

Unload all plugins, then reload all enabled plugins from the registry.
Emits: board:restarted event after completion.
restart() is useful after bulk registry changes or when you need a clean slate.

Plugin ID

api.getPluginId()

Returns the ID of the currently loading plugin. Only has a value while a plugin’s setup() is executing.
Returns: string | null