@lvce-editor/ipc 8.0.1 → 8.2.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/index.js +26 -39
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -416,13 +416,9 @@ const listen$4 = async () => {
|
|
|
416
416
|
}
|
|
417
417
|
return process;
|
|
418
418
|
};
|
|
419
|
-
|
|
420
|
-
// @ts-ignore
|
|
421
419
|
const signal$3 = process => {
|
|
422
420
|
process.send(readyMessage);
|
|
423
421
|
};
|
|
424
|
-
|
|
425
|
-
// @ts-ignore
|
|
426
422
|
const getActualData = (message, handle) => {
|
|
427
423
|
if (handle) {
|
|
428
424
|
return {
|
|
@@ -432,43 +428,34 @@ const getActualData = (message, handle) => {
|
|
|
432
428
|
}
|
|
433
429
|
return message;
|
|
434
430
|
};
|
|
435
|
-
|
|
436
|
-
|
|
431
|
+
class IpcChildWithNodeForkedProcess extends Ipc {
|
|
432
|
+
constructor(process) {
|
|
433
|
+
super(process);
|
|
434
|
+
}
|
|
435
|
+
getData(message, handle) {
|
|
436
|
+
return getActualData(message, handle);
|
|
437
|
+
}
|
|
438
|
+
onClose(callback) {
|
|
439
|
+
this._rawIpc.on('close', callback);
|
|
440
|
+
}
|
|
441
|
+
send(message) {
|
|
442
|
+
this._rawIpc.send(message);
|
|
443
|
+
}
|
|
444
|
+
onMessage(callback) {
|
|
445
|
+
this._rawIpc.on('message', callback);
|
|
446
|
+
}
|
|
447
|
+
sendAndTransfer(message, transfer) {
|
|
448
|
+
this._rawIpc.send(message, transfer);
|
|
449
|
+
}
|
|
450
|
+
dispose() {
|
|
451
|
+
// ignore
|
|
452
|
+
}
|
|
453
|
+
}
|
|
437
454
|
const wrap$7 = process => {
|
|
438
|
-
return
|
|
439
|
-
process,
|
|
440
|
-
// @ts-ignore
|
|
441
|
-
on(event, listener) {
|
|
442
|
-
if (event === 'message') {
|
|
443
|
-
// @ts-ignore
|
|
444
|
-
const wrappedListener = (event, handle) => {
|
|
445
|
-
const actualData = getActualData(event, handle);
|
|
446
|
-
const syntheticEvent = {
|
|
447
|
-
data: actualData,
|
|
448
|
-
target: this
|
|
449
|
-
};
|
|
450
|
-
listener(syntheticEvent);
|
|
451
|
-
};
|
|
452
|
-
this.process.on(event, wrappedListener);
|
|
453
|
-
} else if (event === 'close') {
|
|
454
|
-
this.process.on('close', listener);
|
|
455
|
-
} else {
|
|
456
|
-
throw new Error('unsupported event type');
|
|
457
|
-
}
|
|
458
|
-
},
|
|
459
|
-
// @ts-ignore
|
|
460
|
-
off(event, listener) {
|
|
461
|
-
this.process.off(event, listener);
|
|
462
|
-
},
|
|
463
|
-
// @ts-ignore
|
|
464
|
-
send(message) {
|
|
465
|
-
this.process.send(message);
|
|
466
|
-
},
|
|
467
|
-
dispose() {}
|
|
468
|
-
};
|
|
455
|
+
return new IpcChildWithNodeForkedProcess(process);
|
|
469
456
|
};
|
|
470
457
|
|
|
471
|
-
const IpcChildWithNodeForkedProcess = {
|
|
458
|
+
const IpcChildWithNodeForkedProcess$1 = {
|
|
472
459
|
__proto__: null,
|
|
473
460
|
listen: listen$4,
|
|
474
461
|
signal: signal$3,
|
|
@@ -1185,4 +1172,4 @@ const IpcParentWithNodeWorker = {
|
|
|
1185
1172
|
wrap
|
|
1186
1173
|
};
|
|
1187
1174
|
|
|
1188
|
-
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
|
1175
|
+
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess$1 as IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/ipc",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"description": "Inter Process Communication for Lvce Editor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@lvce-editor/assert": "^1.2.0",
|
|
18
18
|
"@lvce-editor/verror": "^1.2.0",
|
|
19
|
-
"@lvce-editor/web-socket-server": "^1.
|
|
19
|
+
"@lvce-editor/web-socket-server": "^1.2.0"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
22
|
"node": ">=18"
|