MCPcopy Create free account
hub / github.com/thetarnav/solid-devtools / observeComputationUpdate

Function observeComputationUpdate

packages/debugger/src/main/observe.ts:71–83  ·  view source on GitHub ↗
(
    owner: Solid.Computation,
    onRun: VoidFunction,
    symbol = Symbol(),
)

Source from the content-addressed store, hash-verified

69const ComputationUpdateListeners = new WeakMap<Solid.Computation, Record<symbol, VoidFunction>>()
70
71export function observeComputationUpdate(
72 owner: Solid.Computation,
73 onRun: VoidFunction,
74 symbol = Symbol(),
75): void {
76 let map = ComputationUpdateListeners.get(owner)
77 if (!map) ComputationUpdateListeners.set(owner, (map = {}))
78 map[symbol] = onRun
79 interceptComputationRerun(owner, fn => {
80 fn()
81 for (const sym of Object.getOwnPropertySymbols(map)) map[sym]!()
82 })
83}
84
85export function removeComputationUpdateObserver(owner: Solid.Computation, symbol: symbol): void {
86 const map = ComputationUpdateListeners.get(owner)

Callers 2

observeComputationFunction · 0.90
observeNodeUpdateFunction · 0.90

Calls 3

getMethod · 0.80
fnFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…