@lvce-editor/file-system-worker 1.17.0 → 1.19.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.
@@ -1318,6 +1318,9 @@ const watchCallbacks = Object.create(null);
1318
1318
  const registerWatchCallback = (id, fn) => {
1319
1319
  watchCallbacks[id] = fn;
1320
1320
  };
1321
+ const executeWatchCallBack = async id => {
1322
+ await watchCallbacks[id]();
1323
+ };
1321
1324
  const unregisterWatchCallback = id => {
1322
1325
  delete watchCallbacks[id];
1323
1326
  };
@@ -1330,6 +1333,9 @@ const watchFile = async (id, uri, rpc) => {
1330
1333
  // @ts-ignore
1331
1334
  await invoke('FileSystem.watchFile', id, uri);
1332
1335
  };
1336
+ const executeWatchCallback = async id => {
1337
+ await executeWatchCallBack(id);
1338
+ };
1333
1339
  const unwatchFile = async id => {
1334
1340
  unregisterWatchCallback(id);
1335
1341
  // @ts-ignore
@@ -1383,11 +1389,13 @@ const createFileSystemProcessRpcElectron = async () => {
1383
1389
  }
1384
1390
  };
1385
1391
 
1392
+ const commandMapRef = {};
1393
+
1386
1394
  const createFileSystemProcessRpcNode = async () => {
1387
1395
  try {
1388
1396
  const rpc = await WebSocketRpcParent2.create({
1389
1397
  type: 'file-system-process',
1390
- commandMap: {}
1398
+ commandMap: commandMapRef
1391
1399
  });
1392
1400
  return rpc;
1393
1401
  } catch (error) {
@@ -1431,6 +1439,7 @@ const commandMap = {
1431
1439
  'FileSystem.appendFile': appendFile,
1432
1440
  'FileSystem.copy': copy,
1433
1441
  'FileSystem.createFile': createFile,
1442
+ 'FileSystem.executeWatchCallback': executeWatchCallback,
1434
1443
  'FileSystem.exists': exists,
1435
1444
  'FileSystem.getFolderSize': getFolderSize,
1436
1445
  'FileSystem.getPathSeparator': getPathSeparator,
@@ -1444,13 +1453,14 @@ const commandMap = {
1444
1453
  'FileSystem.remove': remove,
1445
1454
  'FileSystem.rename': rename,
1446
1455
  'FileSystem.stat': stat,
1447
- 'FileSystem.watchFile': watchFile,
1448
1456
  'FileSystem.unwatchFile': unwatchFile,
1457
+ 'FileSystem.watchFile': watchFile,
1449
1458
  'FileSystem.writeFile': writeFile,
1450
1459
  'Initialize.initialize': initialize
1451
1460
  };
1452
1461
 
1453
1462
  const listen = async () => {
1463
+ Object.assign(commandMapRef, commandMap);
1454
1464
  const rpc = await WebWorkerRpcClient.create({
1455
1465
  commandMap: commandMap
1456
1466
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/file-system-worker",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "description": "File System Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"