@lvce-editor/ports-view 0.13.0 → 0.13.2
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/portsViewWorkerMain.js +12 -4
- package/package.json +1 -1
|
@@ -1206,6 +1206,7 @@ const toCommandId = key => {
|
|
|
1206
1206
|
};
|
|
1207
1207
|
const create$1 = () => {
|
|
1208
1208
|
const commandQueues = new Map();
|
|
1209
|
+
const instanceIds = Object.create(null);
|
|
1209
1210
|
const generations = Object.create(null);
|
|
1210
1211
|
const states = Object.create(null);
|
|
1211
1212
|
const commandMapRef = Object.create(null);
|
|
@@ -1320,6 +1321,9 @@ const create$1 = () => {
|
|
|
1320
1321
|
},
|
|
1321
1322
|
set(uid, oldState, newState, scheduledState) {
|
|
1322
1323
|
const current = states[uid];
|
|
1324
|
+
if (!current) {
|
|
1325
|
+
instanceIds[uid] = (instanceIds[uid] || 0) + 1;
|
|
1326
|
+
}
|
|
1323
1327
|
if (!current || oldState === newState && newState !== current.newState) {
|
|
1324
1328
|
generations[uid] = getGeneration(uid) + 1;
|
|
1325
1329
|
}
|
|
@@ -1413,8 +1417,9 @@ const create$1 = () => {
|
|
|
1413
1417
|
},
|
|
1414
1418
|
wrapSerialAsyncCommand(fn) {
|
|
1415
1419
|
const wrapped = async (uid, ...args) => {
|
|
1420
|
+
const instanceId = instanceIds[uid];
|
|
1416
1421
|
await enqueueCommand(uid, async () => {
|
|
1417
|
-
if (!states[uid]) {
|
|
1422
|
+
if (!states[uid] || instanceIds[uid] !== instanceId) {
|
|
1418
1423
|
return;
|
|
1419
1424
|
}
|
|
1420
1425
|
const generation = getGeneration(uid);
|
|
@@ -1426,8 +1431,9 @@ const create$1 = () => {
|
|
|
1426
1431
|
},
|
|
1427
1432
|
wrapSerialCommand(fn) {
|
|
1428
1433
|
const wrapped = async (uid, ...args) => {
|
|
1434
|
+
const instanceId = instanceIds[uid];
|
|
1429
1435
|
await enqueueCommand(uid, async () => {
|
|
1430
|
-
if (!states[uid]) {
|
|
1436
|
+
if (!states[uid] || instanceIds[uid] !== instanceId) {
|
|
1431
1437
|
return;
|
|
1432
1438
|
}
|
|
1433
1439
|
const generation = getGeneration(uid);
|
|
@@ -2508,12 +2514,14 @@ const set = rpc => {
|
|
|
2508
2514
|
state.connected = true;
|
|
2509
2515
|
};
|
|
2510
2516
|
|
|
2511
|
-
const handleMessagePort = async port => {
|
|
2517
|
+
const handleMessagePort = async (port, setAsRendererProcess = true) => {
|
|
2512
2518
|
const rpc = await create$4({
|
|
2513
2519
|
commandMap: createDirectEventCommandMap(uid => invoke$1('Viewlet.requestRender', uid)),
|
|
2514
2520
|
messagePort: port
|
|
2515
2521
|
});
|
|
2516
|
-
|
|
2522
|
+
if (setAsRendererProcess) {
|
|
2523
|
+
set(rpc);
|
|
2524
|
+
}
|
|
2517
2525
|
};
|
|
2518
2526
|
|
|
2519
2527
|
const handleWheel = (state, deltaMode, deltaY) => {
|