rumious 2.1.1 → 2.1.2
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/dist/index.js +12 -1
- package/dist/state/store.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -410,10 +410,21 @@ class RumiousStore {
|
|
410
410
|
states = {};
|
411
411
|
constructor(value) {
|
412
412
|
this.value = value;
|
413
|
-
|
413
|
+
this.init(value);
|
414
|
+
}
|
415
|
+
init(value) {
|
416
|
+
for (let key in value) {
|
414
417
|
this.states[key] = createState(value[key]);
|
415
418
|
}
|
416
419
|
}
|
420
|
+
assign(value) {
|
421
|
+
for (let key in value) {
|
422
|
+
if (!this.states[key])
|
423
|
+
this.states[key] = createState(value[key]);
|
424
|
+
else
|
425
|
+
this.states[key].set(value[key]);
|
426
|
+
}
|
427
|
+
}
|
417
428
|
get(key) {
|
418
429
|
return this.states[key];
|
419
430
|
}
|
package/dist/state/store.d.ts
CHANGED
@@ -6,6 +6,8 @@ export declare class RumiousStore<T extends {}> {
|
|
6
6
|
value: T;
|
7
7
|
states: RumiousStoreReactiveMap<T>;
|
8
8
|
constructor(value: T);
|
9
|
+
private init;
|
10
|
+
assign(value: T): void;
|
9
11
|
get<K extends keyof T>(key: K): RumiousState<T[K]>;
|
10
12
|
set(value: T): void;
|
11
13
|
map<U>(fn: <K extends keyof T>(state: RumiousState<T[K]>, key: K) => U): U[];
|