refactor: ginify protocol (#22812)
This commit is contained in:
parent
b3d3ac4e0f
commit
e73d5e3db5
12 changed files with 192 additions and 112 deletions
|
@ -9,7 +9,7 @@ Object.setPrototypeOf(protocol, new Proxy({}, {
|
|||
if (!app.isReady()) return;
|
||||
|
||||
const protocol = session.defaultSession!.protocol;
|
||||
if (!Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(protocol), property)) return;
|
||||
if (!Object.prototype.hasOwnProperty.call(protocol, property)) return;
|
||||
|
||||
// Returning a native function directly would throw error.
|
||||
return (...args: any[]) => (protocol[property as keyof Electron.Protocol] as Function)(...args);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const { EventEmitter } = require('events');
|
||||
const { app, deprecate } = require('electron');
|
||||
const { fromPartition, Session, Protocol } = process.electronBinding('session');
|
||||
const { fromPartition, Session } = process.electronBinding('session');
|
||||
|
||||
// Public API.
|
||||
Object.defineProperties(exports, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue