@lvce-editor/ipc 7.4.0 → 8.0.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.
Files changed (2) hide show
  1. package/dist/browser.js +11 -1
  2. package/package.json +1 -1
package/dist/browser.js CHANGED
@@ -370,7 +370,17 @@ class IpcChildWithWindow extends Ipc {
370
370
  // ignore
371
371
  }
372
372
  onMessage(callback) {
373
- this._rawIpc.addEventListener('message', callback);
373
+ const wrapped = event => {
374
+ const {
375
+ ports
376
+ } = event;
377
+ if (ports.length) {
378
+ return;
379
+ }
380
+ callback(event);
381
+ this._rawIpc.removeEventListener('message', wrapped);
382
+ };
383
+ this._rawIpc.addEventListener('message', wrapped);
374
384
  }
375
385
  }
376
386
  const wrap$2 = window => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ipc",
3
- "version": "7.4.0",
3
+ "version": "8.0.0",
4
4
  "description": "Inter Process Communication for Lvce Editor",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",