Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix(electron): add comment about main/renderer process patch
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLiPassion committed Dec 23, 2017
1 parent c9d0dc6 commit 51c554e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/extra/electron.ts
Expand Up @@ -7,7 +7,8 @@
*/
Zone.__load_patch('electron', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
const FUNCTION = 'function';
const {desktopCapturer, shell} = require('electron');
const {desktopCapturer, shell, CallbackRegistry} = require('electron');
// patch api in renderer process directly
// desktopCapturer
if (desktopCapturer) {
api.patchArguments(desktopCapturer, 'getSources', 'electron.desktopCapturer.getSources');
Expand All @@ -16,10 +17,11 @@ Zone.__load_patch('electron', (global: any, Zone: ZoneType, api: _ZonePrivate) =
if (shell) {
api.patchArguments(shell, 'openExternal', 'electron.shell.openExternal');
}
const CallbacksRegistry = require('electron').CallbacksRegistry;
if (!CallbacksRegistry) {

// patch api in main process through CallbackRegistry
if (!CallbackRegistry) {
return;
}

api.patchArguments(CallbacksRegistry.prototype, 'add', 'CallbackRegistry.add');
api.patchArguments(CallbackRegistry.prototype, 'add', 'CallbackRegistry.add');
});

0 comments on commit 51c554e

Please sign in to comment.