@exodus/atoms
Advanced tools
Comparing version 3.5.3 to 3.6.0
{ | ||
"name": "@exodus/atoms", | ||
"version": "3.5.3", | ||
"version": "3.6.0", | ||
"main": "src/index.js", | ||
@@ -37,3 +37,3 @@ "author": "Exodus Movement Inc.", | ||
}, | ||
"gitHead": "781ff01e727e9f2512d9419bc1a7306d46bc57ef" | ||
"gitHead": "9352420baa5144820706bb4d9476f0e7b535a72a" | ||
} |
@@ -46,5 +46,12 @@ import makeConcurrent from 'make-concurrent' | ||
const set = async (value) => { | ||
// support a function a la React's setState(oldState => newState) | ||
if (typeof value === 'function') value = await value(await get()) | ||
await atom.set(value) | ||
} | ||
return { | ||
get, | ||
set: atom.set, | ||
set, | ||
observe, | ||
@@ -51,0 +58,0 @@ } |
import enforceObservableRules from './enforce-rules' | ||
const fromEventEmitter = ({ emitter, event, get, defaultValue }) => { | ||
const fromEventEmitter = ({ emitter, event, get, set, defaultValue }) => { | ||
const observe = (listener) => { | ||
@@ -11,2 +11,3 @@ emitter.on(event, listener) | ||
get, | ||
set, | ||
observe, | ||
@@ -13,0 +14,0 @@ defaultValue, |
@@ -33,8 +33,5 @@ import EventEmitter from 'events/' | ||
return { | ||
...fromEventEmitter({ emitter, event: 'data', get, defaultValue }), | ||
set, | ||
} | ||
return fromEventEmitter({ emitter, event: 'data', get, set, defaultValue }) | ||
} | ||
export default createAtomMock |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18557
495