@suey/rxp-meta 0.0.2 → 0.1.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/dist/commonjs/index.js +0 -3
- package/dist/commonjs/src/base/InnerZustandStoreManager.js +15 -12
- package/dist/commonjs/src/base/index.js +17 -0
- package/dist/commonjs/src/base/rxpInnerStore.js +65 -0
- package/dist/commonjs/src/constants/index.js +25 -0
- package/dist/commonjs/src/extension/At.js +113 -0
- package/dist/commonjs/src/extension/ExtensionManager.js +66 -101
- package/dist/commonjs/src/extension/ExtensionManager.old.js +156 -0
- package/dist/commonjs/src/metadata/MetadataManager.js +104 -111
- package/dist/commonjs/src/metadata/MetadataManager.old.js +171 -0
- package/dist/commonjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/src/base/InnerZustandStoreManager.js +15 -12
- package/dist/esm/src/base/index.js +1 -0
- package/dist/esm/src/base/rxpInnerStore.js +61 -0
- package/dist/esm/src/constants/index.js +22 -0
- package/dist/esm/src/extension/At.js +109 -0
- package/dist/esm/src/extension/ExtensionManager.js +64 -100
- package/dist/esm/src/extension/ExtensionManager.old.js +152 -0
- package/dist/esm/src/metadata/MetadataManager.js +105 -112
- package/dist/esm/src/metadata/MetadataManager.old.js +167 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/src/base/InnerZustandStoreManager.d.ts +11 -3
- package/dist/lib/src/base/index.d.ts +1 -0
- package/dist/lib/src/base/rxpInnerStore.d.ts +40 -0
- package/dist/lib/src/constants/index.d.ts +19 -0
- package/dist/lib/src/extension/At.d.ts +53 -0
- package/dist/lib/src/extension/ExtensionManager.d.ts +52 -9
- package/dist/lib/src/extension/ExtensionManager.old.d.ts +52 -0
- package/dist/lib/src/extension/declare.d.ts +9 -8
- package/dist/lib/src/extension/index.d.ts +2 -1
- package/dist/lib/src/metadata/MetadataManager.d.ts +64 -15
- package/dist/lib/src/metadata/MetadataManager.old.d.ts +125 -0
- package/dist/lib/src/metadata/declare.d.ts +2 -12
- package/dist/lib/src/metadata/index.d.ts +0 -1
- package/dist/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -6
- package/dist/commonjs/src/rApp.js +0 -102
- package/dist/esm/src/rApp.js +0 -99
- package/dist/lib/src/rApp.d.ts +0 -99
|
@@ -1,159 +1,134 @@
|
|
|
1
|
-
import { useLayoutEffect,
|
|
2
|
-
import {
|
|
3
|
-
export class MetadataManager
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { RxpInnerStore } from '../base/index';
|
|
3
|
+
export class MetadataManager {
|
|
4
|
+
rxpInnerStore = new RxpInnerStore();
|
|
4
5
|
metadataMap = new Map();
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
this.metadataChangeListeners.forEach(listener => listener(payload));
|
|
8
|
-
}
|
|
9
|
-
subscribeMetadataStoreChanged(listener) {
|
|
10
|
-
this.metadataChangeListeners.add(listener);
|
|
11
|
-
return () => {
|
|
12
|
-
this.metadataChangeListeners.delete(listener);
|
|
13
|
-
};
|
|
6
|
+
constructor() {
|
|
7
|
+
this.metadataMap.clear();
|
|
14
8
|
}
|
|
15
9
|
defineMetadata(metadataKey, metadata) {
|
|
16
10
|
this.metadataMap.set(metadataKey, metadata);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
metadataKey: metadataKey,
|
|
22
|
-
metadata: metadata
|
|
23
|
-
});
|
|
11
|
+
this.rxpInnerStore.update();
|
|
12
|
+
return () => {
|
|
13
|
+
this.delMetadata(metadataKey);
|
|
14
|
+
};
|
|
24
15
|
}
|
|
25
16
|
getMetadata(metadataKey) {
|
|
26
17
|
return (this.metadataMap.get(metadataKey)) ?? null;
|
|
27
18
|
}
|
|
19
|
+
getMetadataLatestInVector(metadataKey) {
|
|
20
|
+
return (this.metadataMap.get(metadataKey) ?? [])[this.metadataMap.get(metadataKey)?.length - 1] ?? null;
|
|
21
|
+
}
|
|
22
|
+
getMetadataOldestInVector(metadataKey) {
|
|
23
|
+
return (this.metadataMap.get(metadataKey) ?? [])[0] ?? null;
|
|
24
|
+
}
|
|
28
25
|
delMetadata(metadataKey) {
|
|
29
26
|
if (!this.hasMetadata(metadataKey))
|
|
30
27
|
return;
|
|
31
28
|
this.metadataMap.delete(metadataKey);
|
|
32
|
-
|
|
33
|
-
this.triggerMetadataChangeListeners({
|
|
34
|
-
action: 'Remove',
|
|
35
|
-
type: 'All',
|
|
36
|
-
metadataKey: metadataKey,
|
|
37
|
-
metadata: this.metadataMap.get(metadataKey)
|
|
38
|
-
});
|
|
29
|
+
this.rxpInnerStore.update();
|
|
39
30
|
}
|
|
40
31
|
defineMetadataInSingle(metadataKey, metadata) {
|
|
41
32
|
this.metadataMap.set(metadataKey, metadata);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
metadataKey: metadataKey,
|
|
47
|
-
metadata: metadata
|
|
48
|
-
});
|
|
33
|
+
this.rxpInnerStore.update();
|
|
34
|
+
return () => {
|
|
35
|
+
this.delMetadata(metadataKey);
|
|
36
|
+
};
|
|
49
37
|
}
|
|
50
38
|
defineMetadataInVector(metadataKey, metadata) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
let hasThisMetadata = false;
|
|
40
|
+
if (this.hasMetadata(metadataKey)) {
|
|
41
|
+
const vector = this.metadataMap.get(metadataKey);
|
|
42
|
+
if (!Array.isArray(vector))
|
|
43
|
+
throw new Error(`defineMetadataInVector: current metadata value is not an array`);
|
|
44
|
+
const newVector = vector.map(v => {
|
|
45
|
+
if (v === metadata)
|
|
46
|
+
hasThisMetadata = true;
|
|
47
|
+
return v;
|
|
59
48
|
});
|
|
60
|
-
|
|
49
|
+
if (!hasThisMetadata) {
|
|
50
|
+
newVector.push(metadata);
|
|
51
|
+
this.metadataMap.set(metadataKey, newVector);
|
|
52
|
+
this.rxpInnerStore.update();
|
|
53
|
+
}
|
|
61
54
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return;
|
|
68
|
-
vectorSet.add(metadata);
|
|
69
|
-
const newMetadata = Array.from(vectorSet);
|
|
70
|
-
this.metadataMap.set(metadataKey, newMetadata);
|
|
71
|
-
super.updateStore();
|
|
72
|
-
this.triggerMetadataChangeListeners({
|
|
73
|
-
action: 'Define',
|
|
74
|
-
type: 'Vector',
|
|
75
|
-
metadataKey: metadataKey,
|
|
76
|
-
metadata: newMetadata
|
|
77
|
-
});
|
|
55
|
+
else {
|
|
56
|
+
this.metadataMap.set(metadataKey, [metadata]);
|
|
57
|
+
this.rxpInnerStore.update();
|
|
58
|
+
}
|
|
59
|
+
return () => this.delMetadataInVector(metadataKey, metadata);
|
|
78
60
|
}
|
|
79
61
|
delMetadataInVector(metadataKey, metadata) {
|
|
80
62
|
if (!this.hasMetadata(metadataKey))
|
|
81
63
|
return;
|
|
82
|
-
|
|
64
|
+
let hasThisMetadata = false;
|
|
65
|
+
const vector = this.metadataMap.get(metadataKey) ?? [];
|
|
83
66
|
if (!Array.isArray(vector))
|
|
84
67
|
throw new Error(`delMetadataInVector: current metadata value is not an array`);
|
|
85
68
|
if (vector.length === 0) {
|
|
86
69
|
this.metadataMap.delete(metadataKey);
|
|
70
|
+
this.rxpInnerStore.update();
|
|
87
71
|
return;
|
|
88
72
|
}
|
|
89
|
-
const fVector = vector.filter(v =>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
action: 'Remove',
|
|
95
|
-
type: 'Vector',
|
|
96
|
-
metadataKey: metadataKey,
|
|
97
|
-
metadata: []
|
|
98
|
-
});
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
this.metadataMap.set(metadataKey, fVector);
|
|
102
|
-
super.updateStore();
|
|
103
|
-
this.triggerMetadataChangeListeners({
|
|
104
|
-
action: 'Remove',
|
|
105
|
-
type: 'Vector',
|
|
106
|
-
metadataKey: metadataKey,
|
|
107
|
-
metadata: fVector
|
|
73
|
+
const fVector = vector.filter(v => {
|
|
74
|
+
const isThisMetadata = (v === metadata);
|
|
75
|
+
if (isThisMetadata)
|
|
76
|
+
hasThisMetadata = true;
|
|
77
|
+
return !isThisMetadata;
|
|
108
78
|
});
|
|
79
|
+
if (hasThisMetadata) {
|
|
80
|
+
if (fVector.length === 0) {
|
|
81
|
+
this.metadataMap.delete(metadataKey);
|
|
82
|
+
this.rxpInnerStore.update();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.metadataMap.set(metadataKey, fVector);
|
|
86
|
+
this.rxpInnerStore.update();
|
|
87
|
+
}
|
|
109
88
|
}
|
|
110
89
|
useMetadata(metadataKey) {
|
|
111
90
|
const [_, setState] = useState({});
|
|
112
|
-
const
|
|
91
|
+
const normalState = useRef({
|
|
113
92
|
isMounted: false,
|
|
114
93
|
data: this.getMetadata(metadataKey),
|
|
115
|
-
unsubscribe: void 0
|
|
116
|
-
}));
|
|
117
|
-
const [syncState] = useState(() => ({
|
|
94
|
+
unsubscribe: void 0,
|
|
118
95
|
needSync: false
|
|
119
|
-
})
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
timer = setTimeout(() => {
|
|
127
|
-
timer = void 0;
|
|
128
|
-
if (!normalState.isMounted) {
|
|
129
|
-
syncState.needSync = true;
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
setState({});
|
|
133
|
-
}, timeout);
|
|
134
|
-
};
|
|
96
|
+
});
|
|
97
|
+
const refreshComponent = useCallback(() => {
|
|
98
|
+
if (!normalState.current.isMounted) {
|
|
99
|
+
normalState.current.needSync = true;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setState(() => ({}));
|
|
135
103
|
}, []);
|
|
136
|
-
if (!normalState.unsubscribe) {
|
|
137
|
-
normalState.unsubscribe
|
|
104
|
+
if (!normalState.current.isMounted || !normalState.current.unsubscribe) {
|
|
105
|
+
if (normalState.current.unsubscribe)
|
|
106
|
+
normalState.current.unsubscribe();
|
|
107
|
+
normalState.current.data = this.getMetadata(metadataKey);
|
|
108
|
+
normalState.current.unsubscribe = this.rxpInnerStore.subscribe(() => {
|
|
138
109
|
const data = this.getMetadata(metadataKey);
|
|
139
|
-
if (data !== normalState.data) {
|
|
140
|
-
normalState.data = data;
|
|
141
|
-
|
|
110
|
+
if (data !== normalState.current.data) {
|
|
111
|
+
normalState.current.data = data;
|
|
112
|
+
refreshComponent();
|
|
142
113
|
}
|
|
143
114
|
});
|
|
144
115
|
}
|
|
145
116
|
useLayoutEffect(() => {
|
|
146
|
-
normalState.isMounted = true;
|
|
147
|
-
|
|
148
|
-
|
|
117
|
+
normalState.current.isMounted = true;
|
|
118
|
+
}, []);
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (normalState.current.needSync)
|
|
121
|
+
setState(() => ({}));
|
|
149
122
|
return () => {
|
|
150
|
-
normalState.isMounted = false;
|
|
151
|
-
if (normalState.unsubscribe)
|
|
152
|
-
normalState.unsubscribe();
|
|
153
|
-
normalState.unsubscribe = void 0;
|
|
123
|
+
normalState.current.isMounted = false;
|
|
124
|
+
if (normalState.current.unsubscribe)
|
|
125
|
+
normalState.current.unsubscribe();
|
|
126
|
+
normalState.current.unsubscribe = void 0;
|
|
127
|
+
normalState.current.data = null;
|
|
128
|
+
normalState.current.needSync = false;
|
|
154
129
|
};
|
|
155
130
|
}, []);
|
|
156
|
-
return normalState.data;
|
|
131
|
+
return normalState.current.data;
|
|
157
132
|
}
|
|
158
133
|
useOldestMetadataInVector(metadataKey) {
|
|
159
134
|
const metadata = this.useMetadata(metadataKey);
|
|
@@ -168,10 +143,28 @@ export class MetadataManager extends InnerZustandStoreManager {
|
|
|
168
143
|
return null;
|
|
169
144
|
}
|
|
170
145
|
useAllMetadata() {
|
|
171
|
-
|
|
146
|
+
this.rxpInnerStore.useValueToRenderReactComponent();
|
|
172
147
|
return this.metadataMap;
|
|
173
148
|
}
|
|
174
149
|
hasMetadata(metadataKey) {
|
|
175
150
|
return this.metadataMap.has(metadataKey);
|
|
176
151
|
}
|
|
152
|
+
useFollowMetadata(metadataKey, metadata) {
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const destroy = this.defineMetadata(metadataKey, metadata);
|
|
155
|
+
return destroy;
|
|
156
|
+
}, [metadataKey, metadata]);
|
|
157
|
+
}
|
|
158
|
+
useFollowMetadataInVector(metadataKey, metadata) {
|
|
159
|
+
useEffect(() => {
|
|
160
|
+
const destroy = this.defineMetadataInVector(metadataKey, metadata);
|
|
161
|
+
return destroy;
|
|
162
|
+
}, [metadataKey, metadata]);
|
|
163
|
+
}
|
|
164
|
+
useFollowMetadataInSingle(metadataKey, metadata) {
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
const destroy = this.defineMetadataInSingle(metadataKey, metadata);
|
|
167
|
+
return destroy;
|
|
168
|
+
}, [metadataKey, metadata]);
|
|
169
|
+
}
|
|
177
170
|
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
2
|
+
import { InnerZustandStoreManager } from '../base/InnerZustandStoreManager';
|
|
3
|
+
export class MetadataManager extends InnerZustandStoreManager {
|
|
4
|
+
metadataMap = new Map();
|
|
5
|
+
defineMetadata(metadataKey, metadata) {
|
|
6
|
+
this.metadataMap.set(metadataKey, metadata);
|
|
7
|
+
super.updateStore();
|
|
8
|
+
return () => {
|
|
9
|
+
this.delMetadata(metadataKey);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
getMetadata(metadataKey) {
|
|
13
|
+
return (this.metadataMap.get(metadataKey)) ?? null;
|
|
14
|
+
}
|
|
15
|
+
getMetadataLatestInVector(metadataKey) {
|
|
16
|
+
return (this.metadataMap.get(metadataKey) ?? [])[this.metadataMap.get(metadataKey)?.length - 1] ?? null;
|
|
17
|
+
}
|
|
18
|
+
getMetadataOldestInVector(metadataKey) {
|
|
19
|
+
return (this.metadataMap.get(metadataKey) ?? [])[0] ?? null;
|
|
20
|
+
}
|
|
21
|
+
delMetadata(metadataKey) {
|
|
22
|
+
if (!this.hasMetadata(metadataKey))
|
|
23
|
+
return;
|
|
24
|
+
this.metadataMap.delete(metadataKey);
|
|
25
|
+
super.updateStore();
|
|
26
|
+
}
|
|
27
|
+
defineMetadataInSingle(metadataKey, metadata) {
|
|
28
|
+
this.metadataMap.set(metadataKey, metadata);
|
|
29
|
+
super.updateStore();
|
|
30
|
+
return () => {
|
|
31
|
+
this.delMetadata(metadataKey);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
defineMetadataInVector(metadataKey, metadata) {
|
|
35
|
+
let hasThisMetadata = false;
|
|
36
|
+
if (this.hasMetadata(metadataKey)) {
|
|
37
|
+
const vector = this.metadataMap.get(metadataKey);
|
|
38
|
+
if (!Array.isArray(vector))
|
|
39
|
+
throw new Error(`defineMetadataInVector: current metadata value is not an array`);
|
|
40
|
+
const newVector = vector.filter(v => {
|
|
41
|
+
const isThisMetadata = (v === metadata);
|
|
42
|
+
if (isThisMetadata)
|
|
43
|
+
hasThisMetadata = true;
|
|
44
|
+
return !isThisMetadata;
|
|
45
|
+
});
|
|
46
|
+
if (!hasThisMetadata) {
|
|
47
|
+
newVector.push(metadata);
|
|
48
|
+
this.metadataMap.set(metadataKey, newVector);
|
|
49
|
+
super.updateStore();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.metadataMap.set(metadataKey, [metadata]);
|
|
54
|
+
super.updateStore();
|
|
55
|
+
}
|
|
56
|
+
return () => this.delMetadataInVector(metadataKey, metadata);
|
|
57
|
+
}
|
|
58
|
+
delMetadataInVector(metadataKey, metadata) {
|
|
59
|
+
if (!this.hasMetadata(metadataKey))
|
|
60
|
+
return;
|
|
61
|
+
let hasThisMetadata = false;
|
|
62
|
+
const vector = this.metadataMap.get(metadataKey) ?? [];
|
|
63
|
+
if (!Array.isArray(vector))
|
|
64
|
+
throw new Error(`delMetadataInVector: current metadata value is not an array`);
|
|
65
|
+
if (vector.length === 0) {
|
|
66
|
+
this.metadataMap.delete(metadataKey);
|
|
67
|
+
super.updateStore();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const fVector = vector.filter(v => {
|
|
71
|
+
const isThisMetadata = (v === metadata);
|
|
72
|
+
if (isThisMetadata)
|
|
73
|
+
hasThisMetadata = true;
|
|
74
|
+
return !isThisMetadata;
|
|
75
|
+
});
|
|
76
|
+
if (hasThisMetadata) {
|
|
77
|
+
if (fVector.length === 0) {
|
|
78
|
+
this.metadataMap.delete(metadataKey);
|
|
79
|
+
super.updateStore();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.metadataMap.set(metadataKey, fVector);
|
|
83
|
+
super.updateStore();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
useMetadata(metadataKey) {
|
|
87
|
+
const [_, setState] = useState({});
|
|
88
|
+
const normalState = useRef({
|
|
89
|
+
isMounted: false,
|
|
90
|
+
data: this.getMetadata(metadataKey),
|
|
91
|
+
unsubscribe: void 0,
|
|
92
|
+
needSync: false
|
|
93
|
+
});
|
|
94
|
+
const refreshComponent = useCallback(() => {
|
|
95
|
+
if (!normalState.current.isMounted) {
|
|
96
|
+
normalState.current.needSync = true;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
setState(() => ({}));
|
|
100
|
+
}, []);
|
|
101
|
+
if (!normalState.current.isMounted || !normalState.current.unsubscribe) {
|
|
102
|
+
if (normalState.current.unsubscribe)
|
|
103
|
+
normalState.current.unsubscribe();
|
|
104
|
+
normalState.current.data = this.getMetadata(metadataKey);
|
|
105
|
+
normalState.current.unsubscribe = super.subscribe(() => {
|
|
106
|
+
const data = this.getMetadata(metadataKey);
|
|
107
|
+
if (data !== normalState.current.data) {
|
|
108
|
+
normalState.current.data = data;
|
|
109
|
+
refreshComponent();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
useLayoutEffect(() => {
|
|
114
|
+
normalState.current.isMounted = true;
|
|
115
|
+
}, []);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (normalState.current.needSync)
|
|
118
|
+
setState(() => ({}));
|
|
119
|
+
return () => {
|
|
120
|
+
normalState.current.isMounted = false;
|
|
121
|
+
if (normalState.current.unsubscribe)
|
|
122
|
+
normalState.current.unsubscribe();
|
|
123
|
+
normalState.current.unsubscribe = void 0;
|
|
124
|
+
normalState.current.data = null;
|
|
125
|
+
normalState.current.needSync = false;
|
|
126
|
+
};
|
|
127
|
+
}, []);
|
|
128
|
+
return normalState.current.data;
|
|
129
|
+
}
|
|
130
|
+
useOldestMetadataInVector(metadataKey) {
|
|
131
|
+
const metadata = this.useMetadata(metadataKey);
|
|
132
|
+
if (metadata && Array.isArray(metadata))
|
|
133
|
+
return metadata[0] ?? null;
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
useLatestMetadataInVector(metadataKey) {
|
|
137
|
+
const metadata = this.useMetadata(metadataKey);
|
|
138
|
+
if (metadata && Array.isArray(metadata))
|
|
139
|
+
return metadata[metadata.length - 1] ?? null;
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
useAllMetadata() {
|
|
143
|
+
super.useStoreValueToRerenderComponent();
|
|
144
|
+
return this.metadataMap;
|
|
145
|
+
}
|
|
146
|
+
hasMetadata(metadataKey) {
|
|
147
|
+
return this.metadataMap.has(metadataKey);
|
|
148
|
+
}
|
|
149
|
+
useFollowMetadata(metadataKey, metadata) {
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
const destroy = this.defineMetadata(metadataKey, metadata);
|
|
152
|
+
return destroy;
|
|
153
|
+
}, [metadataKey, metadata]);
|
|
154
|
+
}
|
|
155
|
+
useFollowMetadataInVector(metadataKey, metadata) {
|
|
156
|
+
useEffect(() => {
|
|
157
|
+
const destroy = this.defineMetadataInVector(metadataKey, metadata);
|
|
158
|
+
return destroy;
|
|
159
|
+
}, [metadataKey, metadata]);
|
|
160
|
+
}
|
|
161
|
+
useFollowMetadataInSingle(metadataKey, metadata) {
|
|
162
|
+
useEffect(() => {
|
|
163
|
+
const destroy = this.defineMetadataInSingle(metadataKey, metadata);
|
|
164
|
+
return destroy;
|
|
165
|
+
}, [metadataKey, metadata]);
|
|
166
|
+
}
|
|
167
|
+
}
|