UNPKG

942 BJavaScriptView Raw
1'use strict';
2
3import { makeMutable } from "./core.js";
4export function makeViewDescriptorsSet() {
5 const shareableViewDescriptors = makeMutable([]);
6 const data = {
7 shareableViewDescriptors,
8 add: item => {
9 shareableViewDescriptors.modify(descriptors => {
10 'worklet';
11
12 const index = descriptors.findIndex(descriptor => descriptor.tag === item.tag);
13 if (index !== -1) {
14 descriptors[index] = item;
15 } else {
16 descriptors.push(item);
17 }
18 return descriptors;
19 }, false);
20 },
21 remove: viewTag => {
22 shareableViewDescriptors.modify(descriptors => {
23 'worklet';
24
25 const index = descriptors.findIndex(descriptor => descriptor.tag === viewTag);
26 if (index !== -1) {
27 descriptors.splice(index, 1);
28 }
29 return descriptors;
30 }, false);
31 }
32 };
33 return data;
34}
35//# sourceMappingURL=ViewDescriptorsSet.js.map
\No newline at end of file