UNPKG

@zedux/atoms

Version:

A Molecular State Engine for React

14 lines (13 loc) 624 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AtomInstanceBase = void 0; const index_1 = require("../../utils/index"); class AtomInstanceBase { addDependent({ callback, operation = 'addDependent', } = {}) { const id = this.ecosystem._idGenerator.generateNodeId(); this.ecosystem._graph.addEdge(id, this.id, operation, index_1.Explicit | index_1.External, callback); return () => this.ecosystem._graph.removeEdge(id, this.id); } } exports.AtomInstanceBase = AtomInstanceBase; AtomInstanceBase.$$typeof = Symbol.for(`${index_1.prefix}/AtomInstanceBase`);