layout.register
register(name: string, fn: (ctx: LayoutContext, options?: O) => object, options?: object): () => voidRegister a layout under a "<pack>:<name>" name. It can then be applied
with applyByName. Per engine: it does not affect other engines.
name | string | |
fn | (ctx: LayoutContext, options?: O) => object | Pure function of the layout context; returns target positions. |
options | object |
Returns: () => void
Example
const off = api.layout.register("acme:rack", (ctx, o) => rackLayout(ctx, o));
await api.layout.applyByName("acme:rack");
off();