WarUI documentation

Vanilla ES module mount and destroy

experimental

Mount a grid into a container with no framework and destroy it without leaks.

Live example

Expected behavior

Mount renders the grid. Destroy removes its DOM and listeners and the counter returns to 0. API calls after destroy report GRID_DESTROYED.

Source

import { mountGrid } from '@warlockcode/warui-core';
const mounted = mountGrid(document.getElementById('grid'), { columns, rowData });
mounted.updateConfig({ columns: columns.slice(0, 3) });
mounted.destroy(); // idempotent
mounted.getGrid(); // throws GRID_DESTROYED

API reference

GRID-A02-F02 API
KindNameTypeDescription
FunctionmountGrid—Mounts a grid into a container and returns a MountedGrid.
Methoddestroy—Releases DOM and listeners. Safe to call twice.
MethodisDestroyed—Reports the destroyed state without throwing.
MethodupdateConfig—Merges columns or rowData and re-renders.
ErrorGridDestroyedError—Has code GRID_DESTROYED.