@exodus/atoms 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +16 -3
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -103,8 +103,7 @@ export const createRemoteConfigAtomFactory =
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
const get = async () => {
|
|
106
|
-
|
|
107
|
-
return getValue(remoteConfigJSON)
|
|
106
|
+
return remoteConfig.get(path)
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
const set = async () => {
|
|
@@ -118,7 +117,7 @@ export const createRemoteConfigAtomFactory =
|
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
remoteConfig.on('
|
|
120
|
+
remoteConfig.on('sync', ({ current }) => notify(current))
|
|
122
121
|
|
|
123
122
|
return enforceObservableRules({
|
|
124
123
|
get,
|
|
@@ -128,6 +127,20 @@ export const createRemoteConfigAtomFactory =
|
|
|
128
127
|
})
|
|
129
128
|
}
|
|
130
129
|
|
|
130
|
+
export const createLocalConfigAtomFactory =
|
|
131
|
+
({ localConfig }) =>
|
|
132
|
+
({ key, defaultValue }) => {
|
|
133
|
+
const observe = (listener) =>
|
|
134
|
+
localConfig.on(`update:${key}`, ({ current }) => listener(current))
|
|
135
|
+
|
|
136
|
+
return enforceObservableRules({
|
|
137
|
+
get: () => localConfig.get(key),
|
|
138
|
+
set: (value) => localConfig.set(key, value),
|
|
139
|
+
observe,
|
|
140
|
+
defaultValue,
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
131
144
|
export const fromEventEmitter = ({ emitter, event, get, defaultValue }) => {
|
|
132
145
|
const observe = (listener) => {
|
|
133
146
|
emitter.on(event, listener)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/atoms",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Exodus Movement Inc.",
|
|
6
6
|
"scripts": {
|
|
@@ -28,5 +28,6 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@exodus/storage-memory": "^1.0.0",
|
|
30
30
|
"delay": "^5.0.0"
|
|
31
|
-
}
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "7107d23ea58a8948dbdf7594988941885ddc3b95"
|
|
32
33
|
}
|