Skip to content

@modoki/engine / index / registerReadSource

Function: registerReadSource()

registerReadSource(name, getter): () => void

Register a named live value. A later registration of the same name replaces — warn (in dev) on collision, since two owners claiming one name silently shadow each other. Returns an IDENTITY-SAFE disposer: it removes the entry only if THIS getter is still the registered one, so if owner B overwrote owner A's name, A's disposer running later won't yank B's getter out from under it (the footgun the bare name-keyed unregisterReadSource has). Prefer the returned disposer.

Parameters

name

string

getter

ReadSourceGetter

Returns

() => void

Built with Modoki.