UNPKG

@zedux/atoms

Version:

A Molecular State Engine for React

23 lines (22 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.injectInvalidate = void 0; const EvaluationStack_1 = require("../classes/EvaluationStack"); /** * Returns a function that can be called to invalidate the current atom * instance. * * @deprecated This injector will be removed in the next major release. Use the * following pattern instead: * * ```ts * const self = injectSelf() * // then in a callback or effect: * self.invalidate() * ``` */ const injectInvalidate = () => { const instance = (0, EvaluationStack_1.readInstance)(); return () => instance.invalidate('injectInvalidate', 'Injector'); }; exports.injectInvalidate = injectInvalidate;