Function registerSignalIntegration() sincev5.10.0
function registerSignalIntegration<T>(buildConfig: (options: HooksOptions) => SignalIntegration<T>): void;Defined in: install.ts:356
Adds a SignalIntegration to the graph that @warp-drive/alien-signals/install configured. Use it to build a framework integration on @warp-drive/alien-signals/primitives, the way @warp-drive/react does.
Hooks that also work on their own, without this graph, should be passed to registerSignals from @warp-drive/core/configure instead. It registers them with this graph when the graph is configured, and configures them with setupSignals when it is not.
Throws if the graph is not the configured signals implementation, or if the integration creates its own signals and WarpDrive has already created signals.
Type Parameters
T
T
Parameters
buildConfig
(options: HooksOptions) => SignalIntegration<T>
a function that takes the HooksOptions and returns the integration's hooks
Returns
void
Example
import { isTracking } from '@warp-drive/alien-signals/primitives';
import { registerSignalIntegration } from '@warp-drive/alien-signals/install';
registerSignalIntegration(() => ({
// called with each signal as it is consumed, and each memo just before it is read
consumeSignal: (node) => {
if (!isTracking()) watchInCurrentComponent(node);
},
}));