UNPKG

@zedux/atoms

Version:

A Molecular State Engine for React

10 lines (9 loc) 472 B
import { Explicit, External, prefix, } from '../../utils/index.js'; export class AtomInstanceBase { addDependent({ callback, operation = 'addDependent', } = {}) { const id = this.ecosystem._idGenerator.generateNodeId(); this.ecosystem._graph.addEdge(id, this.id, operation, Explicit | External, callback); return () => this.ecosystem._graph.removeEdge(id, this.id); } } AtomInstanceBase.$$typeof = Symbol.for(`${prefix}/AtomInstanceBase`);