WarUI documentation

Plugin engine and registration

experimental

Register plugins with dependencies and lifecycle hooks, and see the resolved order.

Live example

Expected behavior

Toggling a plugin updates the resolved order. A missing dependency or a plugin that others depend on produces a clear error. The runtime-registered row-counter plugin appears and writes to the footer.

Source

const sorting = definePlugin({ id: 'sorting', version: '1.0.0' });
const selection = definePlugin({ id: 'selection', version: '1.0.0' });
const history = definePlugin({
  id: 'history',
  version: '1.0.0',
  dependsOn: ['selection'],
  keybindings: [{ key: 'Ctrl+Z', description: 'Undo' }],
});
const api = createGrid({ rows, columns, plugins: [history, sorting, selection] });
await api.registerPlugin(rowCounter);
api.on('plugin:registered', ({ id }) => console.log(id));
await api.unregisterPlugin('history');

API reference

GRID-A01-F19 API
KindNameTypeDescription
FunctiondefinePlugin—Validates a plugin manifest and its hooks.
Optionplugins—Plugins registered at creation in dependency order.
MethodregisterPlugin—Registers a plugin at runtime and runs its setup hook.
MethodunregisterPlugin—Runs teardown. Rejected while other plugins depend on it.
Eventplugin:registered—Reports the ID and version of a registered plugin.