react-rock 3.2.16 → 3.2.18
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/Store.cjs +296 -269
- package/Store.cjs.map +1 -1
- package/Store.d.ts +25 -25
- package/Store.js +296 -269
- package/Store.js.map +1 -1
- package/index.cjs +2 -2
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +230 -230
- package/types.d.ts +65 -61
package/Store.d.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { RowSchema, MetaSchema, MakeRowType, CreateManyArgs, CreateArgs, UpdateArgs, DeleteArgs, FindArgs, MoveArgs } from './types.js';
|
|
2
2
|
import { Infer } from 'xanv';
|
|
3
3
|
|
|
4
|
-
declare class Store<RS extends RowSchema, MS extends MetaSchema | undefined = undefined> {
|
|
5
|
-
private _rows;
|
|
6
|
-
private _meta;
|
|
7
|
-
private _hooks;
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
-
private
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
getIndex(args: FindArgs<RS>): number;
|
|
24
|
-
move(args: MoveArgs<RS>): boolean;
|
|
25
|
-
setMeta<T extends keyof Infer<MS>>(key: T, value: Infer<MS>[T], disableObservation?: boolean): void;
|
|
26
|
-
getMeta<T extends keyof Infer<MS>>(key: T, disableObservation?: boolean): Infer<MS>[T] | undefined;
|
|
27
|
-
deleteMeta<T extends keyof Infer<MS>>(key: T, disableObservation?: boolean): void;
|
|
28
|
-
clearMeta(disableObservation?: boolean): void;
|
|
4
|
+
declare class Store<RS extends RowSchema, MS extends MetaSchema | undefined = undefined> {
|
|
5
|
+
private _rows;
|
|
6
|
+
private _meta;
|
|
7
|
+
private _hooks;
|
|
8
|
+
private _row_schema;
|
|
9
|
+
private _meta_schema?;
|
|
10
|
+
private _last_id;
|
|
11
|
+
constructor(rowSchema: RS, metaSchema?: MS);
|
|
12
|
+
observe: (observeId?: string) => void;
|
|
13
|
+
dispatch(observeIdOrCallback?: string | ((cb: Function, key: string) => void)): void;
|
|
14
|
+
rows(disableObservation?: boolean): Map<number, MakeRowType<RS>>;
|
|
15
|
+
metas(disableObservation?: boolean): Map<keyof Infer<MS>, Infer<MS>[keyof Infer<MS>]>;
|
|
16
|
+
createMany(args: CreateManyArgs<RS>): MakeRowType<RS>[];
|
|
17
|
+
create(args: CreateArgs<RS>): MakeRowType<RS>;
|
|
18
|
+
update(args: UpdateArgs<RS>): MakeRowType<RS>[] | null;
|
|
19
|
+
delete(args: DeleteArgs<RS>): number;
|
|
20
|
+
find(args: FindArgs<RS>): MakeRowType<RS>[];
|
|
21
|
+
findOne(args: FindArgs<RS>): MakeRowType<RS> | null;
|
|
22
|
+
findById(rid: number, disableObservation?: boolean): MakeRowType<RS> | undefined;
|
|
23
|
+
getIndex(args: FindArgs<RS>): number;
|
|
24
|
+
move(args: MoveArgs<RS>): boolean;
|
|
25
|
+
setMeta<T extends keyof Infer<MS>>(key: T, value: Infer<MS>[T], disableObservation?: boolean): void;
|
|
26
|
+
getMeta<T extends keyof Infer<MS>>(key: T, disableObservation?: boolean): Infer<MS>[T] | undefined;
|
|
27
|
+
deleteMeta<T extends keyof Infer<MS>>(key: T, disableObservation?: boolean): void;
|
|
28
|
+
clearMeta(disableObservation?: boolean): void;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export { Store as default };
|
package/Store.js
CHANGED
|
@@ -2,275 +2,302 @@
|
|
|
2
2
|
import { useId, useState, useEffect } from 'react';
|
|
3
3
|
import { xv } from 'xanv';
|
|
4
4
|
|
|
5
|
-
const uid = useId;
|
|
6
|
-
const ustate = useState;
|
|
7
|
-
const ueffect = useEffect;
|
|
8
|
-
class Store {
|
|
9
|
-
constructor(rowSchema, metaSchema) {
|
|
10
|
-
|
|
11
|
-
this.
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this._last_id = 0;
|
|
15
|
-
this.observe = (observeId) => {
|
|
16
|
-
try {
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const { data, disableObservation, observeId } = args;
|
|
87
|
-
|
|
88
|
-
let
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
this.
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
5
|
+
const uid = useId;
|
|
6
|
+
const ustate = useState;
|
|
7
|
+
const ueffect = useEffect;
|
|
8
|
+
class Store {
|
|
9
|
+
constructor(rowSchema, metaSchema) {
|
|
10
|
+
// private _rows: MakeRowType<RS>[] = [];
|
|
11
|
+
this._rows = new Map();
|
|
12
|
+
this._meta = new Map();
|
|
13
|
+
this._hooks = new Map();
|
|
14
|
+
this._last_id = 0;
|
|
15
|
+
this.observe = (observeId = "default") => {
|
|
16
|
+
try {
|
|
17
|
+
const _uid = uid();
|
|
18
|
+
const [, dispatch] = ustate(0);
|
|
19
|
+
ueffect(() => {
|
|
20
|
+
const factory = this._hooks.get(observeId) || new Map();
|
|
21
|
+
factory.set(_uid, () => dispatch(Math.random()));
|
|
22
|
+
this._hooks.set(observeId, factory);
|
|
23
|
+
return () => {
|
|
24
|
+
factory.delete(_uid);
|
|
25
|
+
if (factory.size) {
|
|
26
|
+
this._hooks.set(observeId, factory);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
this._hooks.delete(observeId);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
}
|
|
34
|
+
catch (error) { }
|
|
35
|
+
};
|
|
36
|
+
this._row_schema = Object.assign(Object.assign({}, rowSchema), { rid: xv.number(), vid: xv
|
|
37
|
+
.number()
|
|
38
|
+
.default(() => Math.round((Math.random() + Math.random()) * 9999999999)) });
|
|
39
|
+
this._meta_schema = metaSchema;
|
|
40
|
+
}
|
|
41
|
+
dispatch(observeIdOrCallback) {
|
|
42
|
+
if (typeof observeIdOrCallback === "string") {
|
|
43
|
+
const factory = this._hooks.get(observeIdOrCallback);
|
|
44
|
+
factory === null || factory === void 0 ? void 0 : factory.forEach((cb, _uid) => {
|
|
45
|
+
try {
|
|
46
|
+
cb();
|
|
47
|
+
}
|
|
48
|
+
catch (_err) {
|
|
49
|
+
factory.delete(_uid);
|
|
50
|
+
this._hooks.set(observeIdOrCallback, factory);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this._hooks.forEach((factory, key) => {
|
|
56
|
+
factory === null || factory === void 0 ? void 0 : factory.forEach((cb, _uid) => {
|
|
57
|
+
try {
|
|
58
|
+
if (typeof observeIdOrCallback === "function") {
|
|
59
|
+
observeIdOrCallback(cb, key);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
cb();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (_err) {
|
|
66
|
+
factory.delete(_uid);
|
|
67
|
+
this._hooks.set(key, factory);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
rows(disableObservation = false) {
|
|
74
|
+
if (!disableObservation) {
|
|
75
|
+
this.observe();
|
|
76
|
+
}
|
|
77
|
+
return this._rows;
|
|
78
|
+
}
|
|
79
|
+
metas(disableObservation = false) {
|
|
80
|
+
if (!disableObservation) {
|
|
81
|
+
this.observe();
|
|
82
|
+
}
|
|
83
|
+
return this._meta;
|
|
84
|
+
}
|
|
85
|
+
createMany(args) {
|
|
86
|
+
const { data, disableObservation, observeId } = args;
|
|
87
|
+
const res = [];
|
|
88
|
+
for (let row of data) {
|
|
89
|
+
const created = this.create({
|
|
90
|
+
data: row,
|
|
91
|
+
disableObservation: true,
|
|
92
|
+
});
|
|
93
|
+
res.push(created);
|
|
94
|
+
}
|
|
95
|
+
if (!disableObservation) {
|
|
96
|
+
this.dispatch(observeId);
|
|
97
|
+
}
|
|
98
|
+
return res;
|
|
99
|
+
}
|
|
100
|
+
// Row Methods
|
|
101
|
+
create(args) {
|
|
102
|
+
const { data, disableObservation, observeId } = args;
|
|
103
|
+
// validate and create row
|
|
104
|
+
let r = {};
|
|
105
|
+
for (let key in this._row_schema) {
|
|
106
|
+
if (key === "rid" || key === "vid")
|
|
107
|
+
continue;
|
|
108
|
+
const schema = this._row_schema[key];
|
|
109
|
+
r[key] = schema.parse(data[key]);
|
|
110
|
+
}
|
|
111
|
+
this._last_id = this._last_id + 1;
|
|
112
|
+
const _row = Object.assign(Object.assign({}, r), { rid: this._last_id, vid: this._row_schema.vid.parse(undefined) });
|
|
113
|
+
this._rows.set(_row.rid, _row);
|
|
114
|
+
if (!disableObservation) {
|
|
115
|
+
this.dispatch(observeId);
|
|
116
|
+
}
|
|
117
|
+
return _row;
|
|
118
|
+
}
|
|
119
|
+
// update
|
|
120
|
+
update(args) {
|
|
121
|
+
const { data, where, disableObservation, observeId } = args;
|
|
122
|
+
// validate row
|
|
123
|
+
let r = {};
|
|
124
|
+
for (let key in data) {
|
|
125
|
+
if (key === "rid" || key === "vid")
|
|
126
|
+
continue;
|
|
127
|
+
const schema = this._row_schema[key];
|
|
128
|
+
r[key] = schema.parse(data[key]);
|
|
129
|
+
}
|
|
130
|
+
const rows = this.find({ disableObservation: true, where });
|
|
131
|
+
if (rows.length > 0) {
|
|
132
|
+
for (let index = 0; index < rows.length; index++) {
|
|
133
|
+
const _row = rows[index];
|
|
134
|
+
const rid = _row.rid;
|
|
135
|
+
this._rows.set(rid, Object.assign(Object.assign(Object.assign({}, _row), r), { rid, vid: this._row_schema.vid.parse(undefined) }));
|
|
136
|
+
}
|
|
137
|
+
if (!disableObservation) {
|
|
138
|
+
this.dispatch(observeId);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return this.find({ where, disableObservation: true });
|
|
142
|
+
}
|
|
143
|
+
// delete
|
|
144
|
+
delete(args) {
|
|
145
|
+
const { where, disableObservation, observeId } = args;
|
|
146
|
+
const rows = this.find({
|
|
147
|
+
where,
|
|
148
|
+
disableObservation: true,
|
|
149
|
+
});
|
|
150
|
+
let deletedCount = rows.length;
|
|
151
|
+
if (rows.length > 0) {
|
|
152
|
+
for (let row of rows) {
|
|
153
|
+
this._rows.delete(row.rid);
|
|
154
|
+
}
|
|
155
|
+
if (!disableObservation) {
|
|
156
|
+
this.dispatch(observeId);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return deletedCount;
|
|
160
|
+
}
|
|
161
|
+
// find
|
|
162
|
+
find(args) {
|
|
163
|
+
const { where, disableObservation, observeId } = args;
|
|
164
|
+
if (!disableObservation) {
|
|
165
|
+
this.observe(observeId);
|
|
166
|
+
}
|
|
167
|
+
const rows = [];
|
|
168
|
+
for (const row of Array.from(this._rows.values())) {
|
|
169
|
+
let match = true;
|
|
170
|
+
for (const wcol in where) {
|
|
171
|
+
const condition = where[wcol];
|
|
172
|
+
const rvalue = row[wcol];
|
|
173
|
+
if (typeof condition === "object" && condition !== null) {
|
|
174
|
+
if (condition.contain !== undefined) {
|
|
175
|
+
if (typeof rvalue !== "string" ||
|
|
176
|
+
!rvalue.includes(condition.contain)) {
|
|
177
|
+
match = false;
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (condition.startWith !== undefined) {
|
|
182
|
+
if (typeof rvalue !== "string" ||
|
|
183
|
+
!rvalue.startsWith(condition.startWith)) {
|
|
184
|
+
match = false;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (condition.endWith !== undefined) {
|
|
189
|
+
if (typeof rvalue !== "string" ||
|
|
190
|
+
!rvalue.endsWith(condition.endWith)) {
|
|
191
|
+
match = false;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (condition.equalWith !== undefined &&
|
|
196
|
+
rvalue !== condition.equalWith) {
|
|
197
|
+
match = false;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
if (condition.notEqualWith !== undefined &&
|
|
201
|
+
rvalue === condition.notEqualWith) {
|
|
202
|
+
match = false;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
if (condition.gt !== undefined) {
|
|
206
|
+
if (typeof rvalue !== "number" || !(rvalue > condition.gt)) {
|
|
207
|
+
match = false;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (condition.lt !== undefined) {
|
|
212
|
+
if (typeof rvalue !== "number" || !(rvalue < condition.lt)) {
|
|
213
|
+
match = false;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (condition.gte !== undefined) {
|
|
218
|
+
if (typeof rvalue !== "number" || !(rvalue >= condition.gte)) {
|
|
219
|
+
match = false;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (condition.lte !== undefined) {
|
|
224
|
+
if (typeof rvalue !== "number" || !(rvalue <= condition.lte)) {
|
|
225
|
+
match = false;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
if (condition !== rvalue) {
|
|
232
|
+
match = false;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (match) {
|
|
238
|
+
rows.push(row);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return rows;
|
|
242
|
+
}
|
|
243
|
+
findOne(args) {
|
|
244
|
+
const rows = this.find(args);
|
|
245
|
+
return rows.length > 0 ? rows[0] : null;
|
|
246
|
+
}
|
|
247
|
+
findById(rid, disableObservation = false) {
|
|
248
|
+
if (!disableObservation) {
|
|
249
|
+
this.observe(rid.toString());
|
|
250
|
+
}
|
|
251
|
+
return this._rows.get(rid);
|
|
252
|
+
}
|
|
253
|
+
getIndex(args) {
|
|
254
|
+
const row = this.findOne(args);
|
|
255
|
+
if (row) {
|
|
256
|
+
const keys = Array.from(this._rows.keys());
|
|
257
|
+
return keys.indexOf(row.rid);
|
|
258
|
+
}
|
|
259
|
+
return -1;
|
|
260
|
+
}
|
|
261
|
+
move(args) {
|
|
262
|
+
const { fromIndex, toIndex, disableObservation, observeId } = args;
|
|
263
|
+
if (fromIndex < 0 || toIndex < 0)
|
|
264
|
+
return false;
|
|
265
|
+
const entries = [...Array.from(this._rows.entries())];
|
|
266
|
+
if (fromIndex >= entries.length || toIndex >= entries.length) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
const [movedItem] = entries.splice(fromIndex, 1);
|
|
270
|
+
entries.splice(toIndex, 0, movedItem);
|
|
271
|
+
this._rows = new Map(entries);
|
|
272
|
+
if (!disableObservation) {
|
|
273
|
+
this.dispatch(observeId);
|
|
274
|
+
}
|
|
275
|
+
return true;
|
|
276
|
+
}
|
|
277
|
+
setMeta(key, value, disableObservation = false) {
|
|
278
|
+
this._meta.set(key, this._meta_schema ? this._meta_schema[key].parse(value) : value);
|
|
279
|
+
if (!disableObservation) {
|
|
280
|
+
this.dispatch();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
getMeta(key, disableObservation = false) {
|
|
284
|
+
if (!disableObservation) {
|
|
285
|
+
this.observe();
|
|
286
|
+
}
|
|
287
|
+
return this._meta.get(key);
|
|
288
|
+
}
|
|
289
|
+
deleteMeta(key, disableObservation = false) {
|
|
290
|
+
this._meta.delete(key);
|
|
291
|
+
if (!disableObservation) {
|
|
292
|
+
this.dispatch();
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
clearMeta(disableObservation = false) {
|
|
296
|
+
this._meta.clear();
|
|
297
|
+
if (!disableObservation) {
|
|
298
|
+
this.dispatch();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
274
301
|
}
|
|
275
302
|
|
|
276
303
|
export { Store as default };
|