react-native-hox 0.0.2 → 0.0.3
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/LICENSE +15 -0
- package/dist/index.js +5 -4
- package/dist/index.mjs +5 -4
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 wangws
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,8 @@ var createStore = (initialState) => {
|
|
|
27
27
|
const previousState = state;
|
|
28
28
|
const shouldReplace = replace != null ? replace : !isPlainObject(state) || !isPlainObject(nextState);
|
|
29
29
|
state = shouldReplace ? nextState : Object.assign({}, state, nextState);
|
|
30
|
-
|
|
30
|
+
const snapshot = new Set(listeners);
|
|
31
|
+
snapshot.forEach((listener) => listener(state, previousState));
|
|
31
32
|
}
|
|
32
33
|
};
|
|
33
34
|
const getState = () => state;
|
|
@@ -118,7 +119,7 @@ function createModel(initialState, options) {
|
|
|
118
119
|
isDestroyed = true;
|
|
119
120
|
store.destroy();
|
|
120
121
|
};
|
|
121
|
-
const reset = () =>
|
|
122
|
+
const reset = () => setState(initialValue, true);
|
|
122
123
|
const subscribe = createSubscribe(store);
|
|
123
124
|
const data = {
|
|
124
125
|
getState: store.getState,
|
|
@@ -128,7 +129,8 @@ function createModel(initialState, options) {
|
|
|
128
129
|
reset
|
|
129
130
|
};
|
|
130
131
|
Object.defineProperty(data, "state", {
|
|
131
|
-
get: () => store.getState()
|
|
132
|
+
get: () => store.getState(),
|
|
133
|
+
enumerable: true
|
|
132
134
|
});
|
|
133
135
|
const hook = createModelHook(store);
|
|
134
136
|
const model = {
|
|
@@ -244,7 +246,6 @@ function setupModelSideEffects(store, options, logger) {
|
|
|
244
246
|
unsubscribe();
|
|
245
247
|
save.flush();
|
|
246
248
|
isDestroyed = true;
|
|
247
|
-
save.cancel();
|
|
248
249
|
originalDestroy();
|
|
249
250
|
};
|
|
250
251
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -20,7 +20,8 @@ var createStore = (initialState) => {
|
|
|
20
20
|
const previousState = state;
|
|
21
21
|
const shouldReplace = replace != null ? replace : !isPlainObject(state) || !isPlainObject(nextState);
|
|
22
22
|
state = shouldReplace ? nextState : Object.assign({}, state, nextState);
|
|
23
|
-
|
|
23
|
+
const snapshot = new Set(listeners);
|
|
24
|
+
snapshot.forEach((listener) => listener(state, previousState));
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
27
|
const getState = () => state;
|
|
@@ -111,7 +112,7 @@ function createModel(initialState, options) {
|
|
|
111
112
|
isDestroyed = true;
|
|
112
113
|
store.destroy();
|
|
113
114
|
};
|
|
114
|
-
const reset = () =>
|
|
115
|
+
const reset = () => setState(initialValue, true);
|
|
115
116
|
const subscribe = createSubscribe(store);
|
|
116
117
|
const data = {
|
|
117
118
|
getState: store.getState,
|
|
@@ -121,7 +122,8 @@ function createModel(initialState, options) {
|
|
|
121
122
|
reset
|
|
122
123
|
};
|
|
123
124
|
Object.defineProperty(data, "state", {
|
|
124
|
-
get: () => store.getState()
|
|
125
|
+
get: () => store.getState(),
|
|
126
|
+
enumerable: true
|
|
125
127
|
});
|
|
126
128
|
const hook = createModelHook(store);
|
|
127
129
|
const model = {
|
|
@@ -237,7 +239,6 @@ function setupModelSideEffects(store, options, logger) {
|
|
|
237
239
|
unsubscribe();
|
|
238
240
|
save.flush();
|
|
239
241
|
isDestroyed = true;
|
|
240
|
-
save.cancel();
|
|
241
242
|
originalDestroy();
|
|
242
243
|
};
|
|
243
244
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-hox",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "一个轻量级、类型安全、零心智负担的 React Native 状态管理解决方案。",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
},
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
|
-
"README.md"
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
41
42
|
],
|
|
42
43
|
"scripts": {
|
|
43
44
|
"test": "jest",
|