Skip to content
module@warp-drive/alien-signals/primitives

Function hasSubscribers() sincev5.10.0 ​

ts
function hasSubscribers(node: 
  | SignalNode
  | MemoNode<unknown>): boolean;

Defined in: primitives.ts:380

Whether any memo or Watcher depends on node. Useful for debug logging.

Parameters ​

node ​

| SignalNode | MemoNode<unknown>

a signal or memo

Returns ​

boolean

true if a memo or watcher depends on node

Example ​

ts
import { hasSubscribers } from '@warp-drive/alien-signals/primitives';

if (!hasSubscribers(signal)) console.log('nothing will update');

Released under the MIT License.