| 11 | import {batch, createSignal} from 'solid-js' |
| 12 | |
| 13 | export class StoreNodeMap { |
| 14 | map = new Map<NodeID, {node: DecodedValue<ValueType.Store>; refs: number}>() |
| 15 | get(id: NodeID): DecodedValue<ValueType.Store> | null { |
| 16 | return this.map.get(id)?.node || null |
| 17 | } |
| 18 | addRef(id: NodeID, node: DecodedValue<ValueType.Store>) { |
| 19 | const entry = this.map.get(id) |
| 20 | if (entry) entry.refs++ |
| 21 | else this.map.set(id, {node, refs: 1}) |
| 22 | } |
| 23 | removeRef(id: NodeID) { |
| 24 | const entry = this.map.get(id) |
| 25 | if (entry) { |
| 26 | entry.refs-- |
| 27 | if (entry.refs === 0) { |
| 28 | this.map.delete(id) |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | clear() { |
| 33 | this.map.clear() |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | export type ObjectValueData = { |
| 38 | readonly value: Record<string | number, DecodedValue> | DecodedValue[] | null |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…