(
owner: Solid.Computation,
onRun: VoidFunction,
symbol = Symbol(),
)
| 69 | const ComputationUpdateListeners = new WeakMap<Solid.Computation, Record<symbol, VoidFunction>>() |
| 70 | |
| 71 | export 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 | |
| 85 | export function removeComputationUpdateObserver(owner: Solid.Computation, symbol: symbol): void { |
| 86 | const map = ComputationUpdateListeners.get(owner) |
no test coverage detected
searching dependent graphs…