Skip to content

plugin api

laurel Lin edited this page Aug 22, 2026 · 2 revisions

src/plugin_api.ts — Type-safe plugin registration

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.

registerPlugin(id, options)

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 to Plugin.register (PluginOptions isn't exported from that module, so it's extracted via Parameters).

Returns: the registered Plugin instance.


← Back to English API Reference

Clone this wiki locally