@lvce-editor/main-process 6.33.2 → 6.33.4

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.
@@ -3501,7 +3501,9 @@ const getSharedProcessExecArgv = isProduction => {
3501
3501
  return [];
3502
3502
  };
3503
3503
 
3504
- const EmbedsProcess = 2;
3504
+ const EmbedsProcess$1 = 207;
3505
+
3506
+ const EmbedsProcess = EmbedsProcess$1;
3505
3507
  const MainProcess = -5;
3506
3508
 
3507
3509
  const mark = key => {
@@ -6252,7 +6254,7 @@ const handleWebContentsViewZoomKeyBinding = (webContentsId, input) => {
6252
6254
  };
6253
6255
 
6254
6256
  const key$8 = 'before-input';
6255
- const attach$9 = (webContents, listener) => {
6257
+ const attach$a = (webContents, listener) => {
6256
6258
  webContents.on(BeforeInputEvent, listener);
6257
6259
  };
6258
6260
  const detach$8 = (webContents, listener) => {
@@ -6292,14 +6294,14 @@ const handler$8 = (event, input, webContentsId) => {
6292
6294
 
6293
6295
  const ElectronBrowserViewEventListenerBeforeInput = {
6294
6296
  __proto__: null,
6295
- attach: attach$9,
6297
+ attach: attach$a,
6296
6298
  detach: detach$8,
6297
6299
  handler: handler$8,
6298
6300
  key: key$8
6299
6301
  };
6300
6302
 
6301
6303
  const key$7 = 'context-menu';
6302
- const attach$8 = (webContents, listener) => {
6304
+ const attach$9 = (webContents, listener) => {
6303
6305
  webContents.on(ContextMenu, listener);
6304
6306
  };
6305
6307
  const detach$7 = (webContents, listener) => {
@@ -6314,14 +6316,14 @@ const handler$7 = (event, params) => {
6314
6316
 
6315
6317
  const ElectronBrowserViewEventListenerContextMenu = {
6316
6318
  __proto__: null,
6317
- attach: attach$8,
6319
+ attach: attach$9,
6318
6320
  detach: detach$7,
6319
6321
  handler: handler$7,
6320
6322
  key: key$7
6321
6323
  };
6322
6324
 
6323
6325
  const key$6 = 'destroyed';
6324
- const attach$7 = (webContents, listener) => {
6326
+ const attach$8 = (webContents, listener) => {
6325
6327
  webContents.on(Destroyed, listener);
6326
6328
  };
6327
6329
  const detach$6 = (webContents, listener) => {
@@ -6336,14 +6338,14 @@ const handler$6 = () => {
6336
6338
 
6337
6339
  const ElectronBrowserViewEventListenerDestroyed = {
6338
6340
  __proto__: null,
6339
- attach: attach$7,
6341
+ attach: attach$8,
6340
6342
  detach: detach$6,
6341
6343
  handler: handler$6,
6342
6344
  key: key$6
6343
6345
  };
6344
6346
 
6345
6347
  const key$5 = 'did-navigate';
6346
- const attach$6 = (webContents, listener) => {
6348
+ const attach$7 = (webContents, listener) => {
6347
6349
  webContents.on(DidNavigate, listener);
6348
6350
  };
6349
6351
  const detach$5 = (webContents, listener) => {
@@ -6358,7 +6360,7 @@ const handler$5 = (event, url) => {
6358
6360
 
6359
6361
  const ElectronBrowserViewEventListenerDidNavigate = {
6360
6362
  __proto__: null,
6361
- attach: attach$6,
6363
+ attach: attach$7,
6362
6364
  detach: detach$5,
6363
6365
  handler: handler$5,
6364
6366
  key: key$5
@@ -6398,7 +6400,7 @@ const cancelForWebContents = webContentsId => {
6398
6400
  };
6399
6401
 
6400
6402
  const key$4 = Login;
6401
- const attach$5 = (webContents, listener) => {
6403
+ const attach$6 = (webContents, listener) => {
6402
6404
  webContents.on(Login, listener);
6403
6405
  };
6404
6406
  const detach$4 = (webContents, listener) => {
@@ -6423,14 +6425,14 @@ const handler$4 = (event, authenticationResponseDetails, authInfo, callback, web
6423
6425
 
6424
6426
  const ElectronBrowserViewEventListenerLogin = {
6425
6427
  __proto__: null,
6426
- attach: attach$5,
6428
+ attach: attach$6,
6427
6429
  detach: detach$4,
6428
6430
  handler: handler$4,
6429
6431
  key: key$4
6430
6432
  };
6431
6433
 
6432
6434
  const key$3 = PageFaviconUpdated;
6433
- const attach$4 = (webContents, listener) => {
6435
+ const attach$5 = (webContents, listener) => {
6434
6436
  webContents.on(PageFaviconUpdated, listener);
6435
6437
  };
6436
6438
  const detach$3 = (webContents, listener) => {
@@ -6445,14 +6447,14 @@ const handler$3 = (event, favicons) => {
6445
6447
 
6446
6448
  const ElectronBrowserViewEventListenerPageFaviconUpdated = {
6447
6449
  __proto__: null,
6448
- attach: attach$4,
6450
+ attach: attach$5,
6449
6451
  detach: detach$3,
6450
6452
  handler: handler$3,
6451
6453
  key: key$3
6452
6454
  };
6453
6455
 
6454
6456
  const key$2 = 'page-title-updated';
6455
- const attach$3 = (webContents, listener) => {
6457
+ const attach$4 = (webContents, listener) => {
6456
6458
  webContents.on(PageTitleUpdated, listener);
6457
6459
  };
6458
6460
  const detach$2 = (webContents, listener) => {
@@ -6467,14 +6469,14 @@ const handler$2 = (event, title) => {
6467
6469
 
6468
6470
  const ElectronBrowserViewEventListenerPageTitleUpdated = {
6469
6471
  __proto__: null,
6470
- attach: attach$3,
6472
+ attach: attach$4,
6471
6473
  detach: detach$2,
6472
6474
  handler: handler$2,
6473
6475
  key: key$2
6474
6476
  };
6475
6477
 
6476
6478
  const key$1 = 'will-navigate';
6477
- const attach$2 = (webContents, listener) => {
6479
+ const attach$3 = (webContents, listener) => {
6478
6480
  webContents.on(WillNavigate, listener);
6479
6481
  };
6480
6482
  const detach$1 = (webContents, listener) => {
@@ -6489,14 +6491,14 @@ const handler$1 = (event, url) => {
6489
6491
 
6490
6492
  const ElectronBrowserViewEventListenerWillNavigate = {
6491
6493
  __proto__: null,
6492
- attach: attach$2,
6494
+ attach: attach$3,
6493
6495
  detach: detach$1,
6494
6496
  handler: handler$1,
6495
6497
  key: key$1
6496
6498
  };
6497
6499
 
6498
6500
  const key = 'window-open';
6499
- const attach$1 = (webContents, listener) => {
6501
+ const attach$2 = (webContents, listener) => {
6500
6502
  webContents.setWindowOpenHandler(listener);
6501
6503
  };
6502
6504
  const detach = (webContents, listener) => {
@@ -6518,7 +6520,7 @@ const handler = ({
6518
6520
 
6519
6521
  const ElectronBrowserViewEventListenerWindowOpen = {
6520
6522
  __proto__: null,
6521
- attach: attach$1,
6523
+ attach: attach$2,
6522
6524
  detach,
6523
6525
  handler,
6524
6526
  key
@@ -6681,7 +6683,7 @@ const getSession = () => {
6681
6683
  return state.session;
6682
6684
  };
6683
6685
 
6684
- const attach = (webContents, parentWebContents) => {
6686
+ const attach$1 = (webContents, parentWebContents) => {
6685
6687
  let shouldRestoreParentFocus = false;
6686
6688
  webContents.on(DidStartNavigation, (_event, _url, _isInPlace, isMainFrame) => {
6687
6689
  if (!isMainFrame) {
@@ -6698,6 +6700,47 @@ const attach = (webContents, parentWebContents) => {
6698
6700
  });
6699
6701
  };
6700
6702
 
6703
+ const installSoundCloudTimerOptimization = target => {
6704
+ const hostname = target.location.hostname;
6705
+ if (hostname !== 'soundcloud.com' && !hostname.endsWith('.soundcloud.com')) {
6706
+ return;
6707
+ }
6708
+ const marker = '__lvceSoundCloudTimerOptimization';
6709
+ if (Object.hasOwn(target, marker)) {
6710
+ return;
6711
+ }
6712
+ const originalSetTimeout = target.setTimeout.bind(target);
6713
+ Object.defineProperty(target, marker, {
6714
+ value: true
6715
+ });
6716
+ target.setTimeout = (callback, delay, ...args) => {
6717
+ // SoundCloud polls its player position at 60 Hz, causing a full lifecycle update even though its displayed time has one-second precision.
6718
+ const soundCloudPlayerPollingInterval = 1000 / 60;
6719
+ const optimizedPlayerPollingInterval = 100;
6720
+ const optimizedDelay = Object.is(delay, soundCloudPlayerPollingInterval) ? optimizedPlayerPollingInterval : delay;
6721
+ return originalSetTimeout(callback, optimizedDelay, ...args);
6722
+ };
6723
+ };
6724
+ const soundCloudTimerOptimizationScript = `(${installSoundCloudTimerOptimization.toString()})(globalThis)`;
6725
+ const isSoundCloudUrl = url => {
6726
+ try {
6727
+ const {
6728
+ hostname
6729
+ } = new URL(url);
6730
+ return hostname === 'soundcloud.com' || hostname.endsWith('.soundcloud.com');
6731
+ } catch {
6732
+ return false;
6733
+ }
6734
+ };
6735
+ const attach = webContents => {
6736
+ webContents.on(DidNavigate, (_event, url) => {
6737
+ if (!isSoundCloudUrl(url)) {
6738
+ return;
6739
+ }
6740
+ void webContents.executeJavaScript(soundCloudTimerOptimizationScript).catch(() => {});
6741
+ });
6742
+ };
6743
+
6701
6744
  const send = (method, ...params) => {
6702
6745
  const rpc = get(EmbedsProcess);
6703
6746
  if (!rpc) {
@@ -6711,7 +6754,8 @@ const attachEventListenersToWebContents = (webContentsId, webContents, browserWi
6711
6754
  if (webContentsWithEventListeners.has(webContents)) {
6712
6755
  return;
6713
6756
  }
6714
- attach(webContents, browserWindow.webContents);
6757
+ attach$1(webContents, browserWindow.webContents);
6758
+ attach(webContents);
6715
6759
  const values = Object.values(ElectronBrowserViewEventListeners);
6716
6760
  for (const value of values) {
6717
6761
  const wrappedListener = (...args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.33.2",
3
+ "version": "6.33.4",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"