Skip to main content

registerSwatchSourcesFromModule

@zylem/game-lib


@zylem/game-lib / catalog / registerSwatchSourcesFromModule

Function: registerSwatchSourcesFromModule()

registerSwatchSourcesFromModule(kind, module, filter?): () => void

Defined in: packages/game-lib/src/lib/entities/swatch-registry.ts:146

Register every plausible source found on a module namespace object.

  • kind: 'behavior': every export that is a behavior descriptor.
  • kind: 'shader': every function export; with filter a host can narrow this to, say, names starting with create.

Export names become source ids, which is what makes the live path agree with generated code that imports the same names.

Parameters​

kind​

SwatchKind

module​

Record<string, unknown>

filter?​

(exportName, value) => boolean

Returns​

An unregister function for everything this call registered.

() => void