Repository navigation
plugin api
laurel Lin edited this page Aug 22, 2026
·
2 revisions
A type-safe wrapper around Blockbench plugin registration.
Background: blockbench-types exports the Plugin class with register as a module export (only
BBPlugin is declared globally), while lib.dom declares a legacy global Plugin (navigator.plugins-
related) — the conflict makes the global Plugin.register impossible to call directly. This module
imports the official type via import type (erased at compile time) and forwards to the runtime global
Plugin.
Registers the plugin. The id must match the final plugin file name (create_track_gen.js →
'create_track_gen').
export function registerPlugin(id: string, options: PluginOptions): PluginClass;Parameters:
-
id— plugin id; must match the bundled file name (without.js). -
options— the config passed toPlugin.register(PluginOptionsisn't exported from that module, so it's extracted viaParameters).
Returns: the registered Plugin instance.