UNPKG

@zedux/stores

Version:

The legacy composable store model of Zedux

15 lines (14 loc) 518 B
import { injectAtomGetters } from '@zedux/atoms'; import { AtomTemplate } from './AtomTemplate.js'; import { ion } from './ion.js'; export class IonTemplate extends AtomTemplate { constructor(key, stateFactory, _config) { super(key, (...params) => stateFactory(injectAtomGetters(), ...params), _config); this._get = stateFactory; } override(newGet) { const newIon = ion(this.key, newGet || this._get, this._config); newIon._isOverride = true; return newIon; } }