import { Autorun } from './autorun' // The main WeakMap that stores {target -> key -> dep} connections. // Conceptually, it's easier to think of a dependency as a Dep class // which maintains a Set of subscribers, but we simply store them as // raw Sets to reduce memory overhead. export type Dep = Set export type KeyToDepMap = Map export const targetMap: WeakMap = new WeakMap() // WeakMaps that store {raw <-> observed} pairs. export const rawToObserved: WeakMap = new WeakMap() export const observedToRaw: WeakMap = new WeakMap() export const rawToImmutable: WeakMap = new WeakMap() export const immutableToRaw: WeakMap = new WeakMap() // WeakSets for values that are marked immutable or non-reactive during // observable creation. export const immutableValues: WeakSet = new WeakSet() export const nonReactiveValues: WeakSet = new WeakSet()