@zedux/stores
Version:
The legacy composable store model of Zedux
34 lines (33 loc) • 908 B
JavaScript
import { is, Store } from '@zedux/core';
import { prefix } from './atoms-port.js';
export class AtomApi {
constructor(value) {
this.promise = undefined;
this.value = value;
this.store = (is(value, Store) ? value : undefined);
if (is(value, AtomApi)) {
Object.assign(this, value);
}
}
addExports(exports) {
if (!this.exports)
this.exports = exports;
else
this.exports = Object.assign(Object.assign({}, this.exports), exports);
return this;
}
setExports(exports) {
;
this.exports = exports;
return this; // for chaining
}
setPromise(promise) {
this.promise = promise;
return this; // for chaining
}
setTtl(ttl) {
this.ttl = ttl;
return this; // for chaining
}
}
AtomApi.$$typeof = Symbol.for(`${prefix}/AtomApi`);