2019-06-04 00:03:59 +00:00
|
|
|
declare var internalBinding: any;
|
2020-07-10 03:32:26 +00:00
|
|
|
declare var nodeProcess: any;
|
|
|
|
declare var isolatedWorld: any;
|
2020-05-30 09:56:54 +00:00
|
|
|
declare var binding: { get: (name: string) => any; process: NodeJS.Process; createPreloadScript: (src: string) => Function };
|
2019-06-04 00:03:59 +00:00
|
|
|
|
2020-05-10 23:06:07 +00:00
|
|
|
declare const BUILDFLAG: (flag: boolean) => boolean;
|
|
|
|
|
|
|
|
declare const ENABLE_DESKTOP_CAPTURER: boolean;
|
|
|
|
declare const ENABLE_REMOTE_MODULE: boolean;
|
|
|
|
declare const ENABLE_VIEWS_API: boolean;
|
|
|
|
|
2019-02-06 18:27:20 +00:00
|
|
|
declare namespace NodeJS {
|
|
|
|
interface FeaturesBinding {
|
2020-03-10 09:39:40 +00:00
|
|
|
isBuiltinSpellCheckerEnabled(): boolean;
|
2019-02-06 18:27:20 +00:00
|
|
|
isDesktopCapturerEnabled(): boolean;
|
|
|
|
isOffscreenRenderingEnabled(): boolean;
|
2019-09-18 16:52:06 +00:00
|
|
|
isRemoteModuleEnabled(): boolean;
|
2019-02-06 18:27:20 +00:00
|
|
|
isPDFViewerEnabled(): boolean;
|
|
|
|
isRunAsNodeEnabled(): boolean;
|
|
|
|
isFakeLocationProviderEnabled(): boolean;
|
|
|
|
isViewApiEnabled(): boolean;
|
|
|
|
isTtsEnabled(): boolean;
|
|
|
|
isPrintingEnabled(): boolean;
|
2019-08-22 10:17:50 +00:00
|
|
|
isPictureInPictureEnabled(): boolean;
|
2019-07-24 23:01:08 +00:00
|
|
|
isExtensionsEnabled(): boolean;
|
2019-03-30 00:32:52 +00:00
|
|
|
isComponentBuild(): boolean;
|
2019-02-06 18:27:20 +00:00
|
|
|
}
|
2019-02-12 14:22:33 +00:00
|
|
|
|
2020-03-12 01:07:54 +00:00
|
|
|
interface IpcRendererBinding {
|
2019-08-02 19:35:04 +00:00
|
|
|
send(internal: boolean, channel: string, args: any[]): void;
|
|
|
|
sendSync(internal: boolean, channel: string, args: any[]): any;
|
|
|
|
sendToHost(channel: string, args: any[]): void;
|
|
|
|
sendTo(internal: boolean, sendToAll: boolean, webContentsId: number, channel: string, args: any[]): void;
|
2019-08-23 22:45:50 +00:00
|
|
|
invoke<T>(internal: boolean, channel: string, args: any[]): Promise<{ error: string, result: T }>;
|
2020-03-12 01:07:54 +00:00
|
|
|
postMessage(channel: string, message: any, transferables: MessagePort[]): void;
|
2019-08-02 19:35:04 +00:00
|
|
|
}
|
|
|
|
|
2019-02-12 14:22:33 +00:00
|
|
|
interface V8UtilBinding {
|
|
|
|
getHiddenValue<T>(obj: any, key: string): T;
|
|
|
|
setHiddenValue<T>(obj: any, key: string, value: T): void;
|
2019-06-15 08:18:25 +00:00
|
|
|
deleteHiddenValue(obj: any, key: string): void;
|
2019-03-10 22:38:44 +00:00
|
|
|
requestGarbageCollectionForTesting(): void;
|
2020-05-15 18:57:40 +00:00
|
|
|
weaklyTrackValue(value: any): void;
|
|
|
|
clearWeaklyTrackedValues(): void;
|
|
|
|
getWeaklyTrackedValues(): any[];
|
2020-06-11 18:36:03 +00:00
|
|
|
addRemoteObjectRef(contextId: string, id: number): void;
|
2020-07-30 02:04:24 +00:00
|
|
|
triggerFatalErrorForTesting(): void;
|
2019-02-12 14:22:33 +00:00
|
|
|
}
|
2019-06-15 10:44:18 +00:00
|
|
|
|
2020-07-16 18:38:31 +00:00
|
|
|
type AsarFileInfo = {
|
|
|
|
size: number;
|
|
|
|
unpacked: boolean;
|
|
|
|
offset: number;
|
|
|
|
};
|
|
|
|
|
|
|
|
type AsarFileStat = {
|
|
|
|
size: number;
|
|
|
|
offset: number;
|
|
|
|
isFile: boolean;
|
|
|
|
isDirectory: boolean;
|
|
|
|
isLink: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface AsarArchive {
|
|
|
|
readonly path: string;
|
|
|
|
getFileInfo(path: string): AsarFileInfo | false;
|
|
|
|
stat(path: string): AsarFileStat | false;
|
|
|
|
readdir(path: string): string[] | false;
|
|
|
|
realpath(path: string): string | false;
|
|
|
|
copyFileOut(path: string): string | false;
|
2020-08-04 18:48:04 +00:00
|
|
|
read(offset: number, size: number): Promise<ArrayBuffer>;
|
|
|
|
readSync(offset: number, size: number): ArrayBuffer;
|
2020-07-16 18:38:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
interface AsarBinding {
|
|
|
|
createArchive(path: string): AsarArchive;
|
|
|
|
splitPath(path: string): {
|
|
|
|
isAsar: false;
|
|
|
|
} | {
|
|
|
|
isAsar: true;
|
|
|
|
asarPath: string;
|
|
|
|
filePath: string;
|
|
|
|
};
|
|
|
|
initAsarSupport(require: NodeJS.Require): void;
|
|
|
|
}
|
|
|
|
|
2020-05-18 17:22:48 +00:00
|
|
|
type DataPipe = {
|
|
|
|
write: (buf: Uint8Array) => Promise<void>;
|
|
|
|
done: () => void;
|
|
|
|
};
|
|
|
|
type BodyFunc = (pipe: DataPipe) => void;
|
|
|
|
type CreateURLLoaderOptions = {
|
|
|
|
method: string;
|
|
|
|
url: string;
|
|
|
|
extraHeaders?: Record<string, string>;
|
|
|
|
useSessionCookies?: boolean;
|
|
|
|
body: Uint8Array | BodyFunc;
|
|
|
|
session?: Electron.Session;
|
|
|
|
partition?: string;
|
2020-05-20 17:28:38 +00:00
|
|
|
referrer?: string;
|
2020-05-18 17:22:48 +00:00
|
|
|
}
|
|
|
|
type ResponseHead = {
|
|
|
|
statusCode: number;
|
|
|
|
statusMessage: string;
|
|
|
|
httpVersion: { major: number, minor: number };
|
|
|
|
rawHeaders: { key: string, value: string }[];
|
|
|
|
};
|
|
|
|
|
|
|
|
type RedirectInfo = {
|
|
|
|
statusCode: number;
|
|
|
|
newMethod: string;
|
|
|
|
newUrl: string;
|
|
|
|
newSiteForCookies: string;
|
|
|
|
newReferrer: string;
|
|
|
|
insecureSchemeWasUpgraded: boolean;
|
|
|
|
isSignedExchangeFallbackRedirect: boolean;
|
|
|
|
}
|
|
|
|
|
|
|
|
interface URLLoader extends EventEmitter {
|
|
|
|
cancel(): void;
|
|
|
|
on(eventName: 'data', listener: (event: any, data: ArrayBuffer) => void): this;
|
|
|
|
on(eventName: 'response-started', listener: (event: any, finalUrl: string, responseHead: ResponseHead) => void): this;
|
|
|
|
on(eventName: 'complete', listener: (event: any) => void): this;
|
|
|
|
on(eventName: 'error', listener: (event: any, netErrorString: string) => void): this;
|
|
|
|
on(eventName: 'login', listener: (event: any, authInfo: Electron.AuthInfo, callback: (username?: string, password?: string) => void) => void): this;
|
|
|
|
on(eventName: 'redirect', listener: (event: any, redirectInfo: RedirectInfo, headers: Record<string, string>) => void): this;
|
|
|
|
on(eventName: 'upload-progress', listener: (event: any, position: number, total: number) => void): this;
|
|
|
|
on(eventName: 'download-progress', listener: (event: any, current: number) => void): this;
|
|
|
|
}
|
|
|
|
|
2019-02-06 18:27:20 +00:00
|
|
|
interface Process {
|
2019-03-08 18:29:52 +00:00
|
|
|
_linkedBinding(name: string): any;
|
2020-06-23 03:32:45 +00:00
|
|
|
_linkedBinding(name: 'electron_renderer_ipc'): { ipc: IpcRendererBinding };
|
|
|
|
_linkedBinding(name: 'electron_common_v8_util'): V8UtilBinding;
|
|
|
|
_linkedBinding(name: 'electron_common_features'): FeaturesBinding;
|
|
|
|
_linkedBinding(name: 'electron_browser_app'): { app: Electron.App, App: Function };
|
|
|
|
_linkedBinding(name: 'electron_common_command_line'): Electron.CommandLine;
|
|
|
|
_linkedBinding(name: 'electron_browser_desktop_capturer'): {
|
2020-05-26 20:34:24 +00:00
|
|
|
createDesktopCapturer(): ElectronInternal.DesktopCapturer;
|
|
|
|
};
|
2020-06-23 03:32:45 +00:00
|
|
|
_linkedBinding(name: 'electron_browser_net'): {
|
2020-05-18 17:22:48 +00:00
|
|
|
isValidHeaderName: (headerName: string) => boolean;
|
|
|
|
isValidHeaderValue: (headerValue: string) => boolean;
|
|
|
|
Net: any;
|
|
|
|
net: any;
|
|
|
|
createURLLoader(options: CreateURLLoaderOptions): URLLoader;
|
|
|
|
};
|
2020-07-16 18:38:31 +00:00
|
|
|
_linkedBinding(name: 'electron_common_asar'): AsarBinding;
|
2019-02-06 18:27:20 +00:00
|
|
|
log: NodeJS.WriteStream['write'];
|
2019-02-12 14:22:33 +00:00
|
|
|
activateUvLoop(): void;
|
2019-02-18 12:47:07 +00:00
|
|
|
|
|
|
|
// Additional events
|
|
|
|
once(event: 'document-start', listener: () => any): this;
|
|
|
|
once(event: 'document-end', listener: () => any): this;
|
2019-06-04 00:03:59 +00:00
|
|
|
|
|
|
|
// Additional properties
|
|
|
|
_firstFileName?: string;
|
2019-07-16 04:13:32 +00:00
|
|
|
|
|
|
|
helperExecPath: string;
|
2019-08-23 09:18:58 +00:00
|
|
|
isRemoteModuleEnabled: boolean;
|
2019-02-06 18:27:20 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-17 01:06:30 +00:00
|
|
|
|
2019-02-19 17:05:14 +00:00
|
|
|
declare module NodeJS {
|
|
|
|
interface Global {
|
|
|
|
require: NodeRequire;
|
|
|
|
module: NodeModule;
|
|
|
|
__filename: string;
|
|
|
|
__dirname: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-17 17:23:52 +00:00
|
|
|
interface ContextMenuItem {
|
|
|
|
id: number;
|
|
|
|
label: string;
|
|
|
|
type: 'normal' | 'separator' | 'subMenu' | 'checkbox';
|
|
|
|
checked: boolean;
|
|
|
|
enabled: boolean;
|
|
|
|
subItems: ContextMenuItem[];
|
|
|
|
}
|
|
|
|
|
2019-02-17 01:06:30 +00:00
|
|
|
declare interface Window {
|
2019-02-19 17:05:14 +00:00
|
|
|
ELECTRON_DISABLE_SECURITY_WARNINGS?: boolean;
|
|
|
|
ELECTRON_ENABLE_SECURITY_WARNINGS?: boolean;
|
2019-02-26 02:10:26 +00:00
|
|
|
InspectorFrontendHost?: {
|
2019-07-17 17:23:52 +00:00
|
|
|
showContextMenuAtPoint: (x: number, y: number, items: ContextMenuItem[]) => void
|
2019-02-26 02:10:26 +00:00
|
|
|
};
|
|
|
|
DevToolsAPI?: {
|
|
|
|
contextMenuItemSelected: (id: number) => void;
|
|
|
|
contextMenuCleared: () => void
|
|
|
|
};
|
|
|
|
UI?: {
|
|
|
|
createFileSelectorElement: (callback: () => void) => HTMLSpanElement
|
|
|
|
};
|
|
|
|
Persistence?: {
|
|
|
|
FileSystemWorkspaceBinding: {
|
|
|
|
completeURL: (project: string, path: string) => string;
|
|
|
|
}
|
2019-03-07 23:26:23 +00:00
|
|
|
};
|
|
|
|
ResizeObserver: ResizeObserver;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The ResizeObserver interface is used to observe changes to Element's content
|
|
|
|
* rect.
|
|
|
|
*
|
|
|
|
* It is modeled after MutationObserver and IntersectionObserver.
|
|
|
|
*/
|
|
|
|
declare class ResizeObserver {
|
|
|
|
constructor (callback: ResizeObserverCallback);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds target to the list of observed elements.
|
|
|
|
*/
|
|
|
|
observe: (target: Element) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes target from the list of observed elements.
|
|
|
|
*/
|
|
|
|
unobserve: (target: Element) => void;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Clears both the observationTargets and activeTargets lists.
|
|
|
|
*/
|
|
|
|
disconnect: () => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This callback delivers ResizeObserver's notifications. It is invoked by a
|
|
|
|
* broadcast active observations algorithm.
|
|
|
|
*/
|
|
|
|
interface ResizeObserverCallback {
|
|
|
|
(entries: ResizeObserverEntry[], observer: ResizeObserver): void;
|
2019-02-17 01:06:30 +00:00
|
|
|
}
|
2019-03-07 23:26:23 +00:00
|
|
|
|
|
|
|
interface ResizeObserverEntry {
|
|
|
|
/**
|
|
|
|
* @param target The Element whose size has changed.
|
|
|
|
*/
|
|
|
|
new (target: Element): ResizeObserverEntry;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The Element whose size has changed.
|
|
|
|
*/
|
|
|
|
readonly target: Element;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Element's content rect when ResizeObserverCallback is invoked.
|
|
|
|
*/
|
|
|
|
readonly contentRect: DOMRectReadOnly;
|
2019-06-04 23:07:34 +00:00
|
|
|
}
|