electron/typings/internal-electron.d.ts
Samuel Attard 5790869a3f
chore: refactor browser IPC into TS and app API into TS (#16921)
* chore: refactor browser IPC into typescript

* chore: refactor app.ts into Typescript

* Refactors app.dock into cpp
* Removes app.launcher which has not existed for 3 years
* Removes 2 deprecated APIs (that have been deprecated for more than one
major)
* Refactors deprecate.ts as well
2019-02-14 14:29:20 -08:00

48 lines
1.4 KiB
TypeScript

/// <reference path="../electron.d.ts" />
/**
* This file augments the Electron TS namespace with the internal APIs
* that are not documented but are used by Electron internally
*/
declare namespace Electron {
enum ProcessType {
browser = 'browser',
renderer = 'renderer',
worker = 'worker'
}
interface App {
setVersion(version: string): void;
setDesktopName(name: string): void;
setAppPath(path: string | null): void;
}
interface SerializedError {
message: string;
stack?: string,
name: string,
from: Electron.ProcessType,
cause: SerializedError,
__ELECTRON_SERIALIZED_ERROR__: true
}
const deprecate: ElectronInternal.DeprecationUtil;
}
declare namespace ElectronInternal {
type DeprecationHandler = (message: string) => void;
interface DeprecationUtil {
setHandler(handler: DeprecationHandler): void;
getHandler(): DeprecationHandler | null;
warn(oldName: string, newName: string): void;
log(message: string): void;
function(fn: Function, newName: string): Function;
event(emitter: NodeJS.EventEmitter, oldName: string, newName: string): void;
removeProperty<T, K extends (keyof T & string)>(object: T, propertyName: K): T;
renameProperty<T, K extends (keyof T & string)>(object: T, oldName: string, newName: K): T;
promisify<T extends (...args: any[]) => any>(fn: T): T;
promisifyMultiArg<T extends (...args: any[]) => any>(fn: T): T;
}
}