@lvce-editor/output-view 1.11.0 → 1.12.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/outputViewWorkerMain.js +33 -24
- package/package.json +1 -1
|
@@ -1106,7 +1106,8 @@ const {
|
|
|
1106
1106
|
get: get$1,
|
|
1107
1107
|
set: set$4,
|
|
1108
1108
|
wrapCommand,
|
|
1109
|
-
wrapGetter
|
|
1109
|
+
wrapGetter,
|
|
1110
|
+
getKeys
|
|
1110
1111
|
} = create$2();
|
|
1111
1112
|
|
|
1112
1113
|
const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
@@ -1136,7 +1137,8 @@ const create$1 = (id, uri, x, y, width, height, platform, parentId) => {
|
|
|
1136
1137
|
errorCode: 0,
|
|
1137
1138
|
buttons: [],
|
|
1138
1139
|
filteredItems: [],
|
|
1139
|
-
platform
|
|
1140
|
+
platform,
|
|
1141
|
+
watchId: 0
|
|
1140
1142
|
};
|
|
1141
1143
|
set$4(id, state, state);
|
|
1142
1144
|
};
|
|
@@ -1563,6 +1565,32 @@ const handleFilterInput = async (state, value) => {
|
|
|
1563
1565
|
};
|
|
1564
1566
|
};
|
|
1565
1567
|
|
|
1568
|
+
const watchCallbacks = Object.create(null);
|
|
1569
|
+
const registerWatchCallback = (id, fn) => {
|
|
1570
|
+
watchCallbacks[id] = fn;
|
|
1571
|
+
};
|
|
1572
|
+
const executeWatchCallBack = id => {
|
|
1573
|
+
watchCallbacks[id]();
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
const handleChange = watchId => {
|
|
1577
|
+
// console.log('channel changed', watchId)
|
|
1578
|
+
const keys = getKeys();
|
|
1579
|
+
for (const key of keys) {
|
|
1580
|
+
}
|
|
1581
|
+
};
|
|
1582
|
+
const setupChangeListener = async uri => {
|
|
1583
|
+
try {
|
|
1584
|
+
const watchId = Math.random();
|
|
1585
|
+
const rpcId = 7001;
|
|
1586
|
+
registerWatchCallback(watchId, handleChange);
|
|
1587
|
+
// @ts-ignore
|
|
1588
|
+
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri, rpcId);
|
|
1589
|
+
} catch {
|
|
1590
|
+
// ignore
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1566
1594
|
const selectChannel = async (state, id) => {
|
|
1567
1595
|
const {
|
|
1568
1596
|
options,
|
|
@@ -1578,6 +1606,9 @@ const selectChannel = async (state, id) => {
|
|
|
1578
1606
|
error,
|
|
1579
1607
|
code
|
|
1580
1608
|
} = await loadLines(matchingOption.uri);
|
|
1609
|
+
|
|
1610
|
+
// TODO memory leak and race condition, need to dispose file watcher of previous uri
|
|
1611
|
+
await setupChangeListener(matchingOption.uri);
|
|
1581
1612
|
const filteredItems = filterItems(lines, filterValue);
|
|
1582
1613
|
return {
|
|
1583
1614
|
...state,
|
|
@@ -1710,28 +1741,6 @@ const loadOptions = async platform => {
|
|
|
1710
1741
|
}, ...extensionOptions];
|
|
1711
1742
|
};
|
|
1712
1743
|
|
|
1713
|
-
const watchCallbacks = Object.create(null);
|
|
1714
|
-
const registerWatchCallback = (id, fn) => {
|
|
1715
|
-
watchCallbacks[id] = fn;
|
|
1716
|
-
};
|
|
1717
|
-
const executeWatchCallBack = id => {
|
|
1718
|
-
watchCallbacks[id]();
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
|
-
const setupChangeListener = async uri => {
|
|
1722
|
-
try {
|
|
1723
|
-
const watchId = Math.random();
|
|
1724
|
-
registerWatchCallback(watchId, () => {
|
|
1725
|
-
// TODO
|
|
1726
|
-
// console.log('channel changed')
|
|
1727
|
-
});
|
|
1728
|
-
// @ts-ignore
|
|
1729
|
-
await FileSystemWorker.invoke(/* OutputChannel.open */'FileSystem.watchFile', watchId, /* path */uri);
|
|
1730
|
-
} catch {
|
|
1731
|
-
// ignore
|
|
1732
|
-
}
|
|
1733
|
-
};
|
|
1734
|
-
|
|
1735
1744
|
const isString = value => {
|
|
1736
1745
|
return typeof value === 'string';
|
|
1737
1746
|
};
|