1 | 'use strict';
|
---|
2 | /**
|
---|
3 | * @license Angular v12.0.0-next.0
|
---|
4 | * (c) 2010-2020 Google LLC. https://angular.io/
|
---|
5 | * License: MIT
|
---|
6 | */
|
---|
7 | /**
|
---|
8 | * @license
|
---|
9 | * Copyright Google LLC All Rights Reserved.
|
---|
10 | *
|
---|
11 | * Use of this source code is governed by an MIT-style license that can be
|
---|
12 | * found in the LICENSE file at https://angular.io/license
|
---|
13 | */
|
---|
14 | Zone.__load_patch('electron', (global, Zone, api) => {
|
---|
15 | function patchArguments(target, name, source) {
|
---|
16 | return api.patchMethod(target, name, (delegate) => (self, args) => {
|
---|
17 | return delegate && delegate.apply(self, api.bindArguments(args, source));
|
---|
18 | });
|
---|
19 | }
|
---|
20 | const { desktopCapturer, shell, CallbacksRegistry, ipcRenderer } = require('electron');
|
---|
21 | // patch api in renderer process directly
|
---|
22 | // desktopCapturer
|
---|
23 | if (desktopCapturer) {
|
---|
24 | patchArguments(desktopCapturer, 'getSources', 'electron.desktopCapturer.getSources');
|
---|
25 | }
|
---|
26 | // shell
|
---|
27 | if (shell) {
|
---|
28 | patchArguments(shell, 'openExternal', 'electron.shell.openExternal');
|
---|
29 | }
|
---|
30 | // patch api in main process through CallbackRegistry
|
---|
31 | if (!CallbacksRegistry) {
|
---|
32 | if (ipcRenderer) {
|
---|
33 | patchArguments(ipcRenderer, 'on', 'ipcRenderer.on');
|
---|
34 | }
|
---|
35 | return;
|
---|
36 | }
|
---|
37 | patchArguments(CallbacksRegistry.prototype, 'add', 'CallbackRegistry.add');
|
---|
38 | });
|
---|