@exodus/atoms
Advanced tools
Comparing version 3.0.0 to 3.1.0
{ | ||
"name": "@exodus/atoms", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"main": "src/index.js", | ||
@@ -36,3 +36,3 @@ "author": "Exodus Movement Inc.", | ||
}, | ||
"gitHead": "09eebd39041cf2dda35741828ec8e574f374f4f2" | ||
"gitHead": "6aca43c9d371da13ffca0de1d9a0bc9c3f14ee25" | ||
} |
# `@exodus/atoms` | ||
Module to store and manage wallet accounts instances. | ||
## Install | ||
@@ -6,0 +4,0 @@ |
@@ -8,6 +8,17 @@ import { get as getValueAtPath } from 'lodash' | ||
({ remoteConfig }) => | ||
({ path, defaultValue }) => { | ||
({ path, selector, defaultValue }) => { | ||
if (path && selector) { | ||
throw new Error( | ||
'Provide either a path or a selector to get data from remote config - not both.' | ||
) | ||
} | ||
const getValue = (value) => (selector ? selector(value) : getValueAtPath(value, path)) | ||
const { notify, observe } = createSimpleObserver() | ||
const get = () => remoteConfig.get(path) | ||
const get = async () => { | ||
const data = await remoteConfig.getAll() | ||
return getValue(data) | ||
} | ||
@@ -18,3 +29,6 @@ const set = async () => { | ||
remoteConfig.on('sync', ({ current }) => notify(getValueAtPath(current, path))) | ||
remoteConfig.on('sync', async ({ current }) => { | ||
const data = getValue(current) | ||
return notify(data) | ||
}) | ||
@@ -21,0 +35,0 @@ return enforceObservableRules({ |
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
13965
339
90