mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-31 11:40:47 +08:00
Resolves #5090
This commit is contained in:
+213
-170
@@ -1,10 +1,199 @@
|
||||
// Type definitions for the Electron 0.25.2 main process
|
||||
// Type definitions for the Electron 0.25.2 main process
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./github-electron.d.ts" />
|
||||
|
||||
declare module GitHubElectron {
|
||||
interface ContentTracing {
|
||||
/**
|
||||
* Get a set of category groups. The category groups can change as new code paths are reached.
|
||||
* @param callback Called once all child processes have acked to the getCategories request.
|
||||
*/
|
||||
getCategories(callback: (categoryGroups: any[]) => void): void;
|
||||
/**
|
||||
* Start recording on all processes. Recording begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the EnableRecording request.
|
||||
* @param categoryFilter A filter to control what category groups should be traced.
|
||||
* A filter can have an optional "-" prefix to exclude category groups that contain
|
||||
* a matching category. Having both included and excluded category patterns in the
|
||||
* same list would not be supported.
|
||||
* @param options controls what kind of tracing is enabled, it could be a OR-ed
|
||||
* combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING
|
||||
* and tracing.RECORD_CONTINUOUSLY.
|
||||
* @param callback Called once all child processes have acked to the startRecording request.
|
||||
*/
|
||||
startRecording(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop recording on all processes. Child processes typically are caching trace data and
|
||||
* only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid
|
||||
* much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
* child processes to flush any pending trace data.
|
||||
* @param resultFilePath Trace data will be written into this file if it is not empty,
|
||||
* or into a temporary file.
|
||||
* @param callback Called once all child processes have acked to the stopRecording request.
|
||||
*/
|
||||
stopRecording(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data.
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the startMonitoring request.
|
||||
* @param callback Called once all child processes have acked to the startMonitoring request.
|
||||
*/
|
||||
startMonitoring(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop monitoring on all processes.
|
||||
* @param callback Called once all child processes have acked to the stopMonitoring request.
|
||||
*/
|
||||
stopMonitoring(callback: Function): void;
|
||||
/**
|
||||
* Get the current monitoring traced data. Child processes typically are caching trace data
|
||||
* and only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid much
|
||||
* runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child
|
||||
* processes to flush any pending trace data.
|
||||
* @param callback Called once all child processes have acked to the captureMonitoringSnapshot request.
|
||||
*/
|
||||
captureMonitoringSnapshot(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data
|
||||
* @returns {}
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Get the maximum across processes of trace buffer percent full state.
|
||||
* @param callback Called when the TraceBufferUsage value is determined.
|
||||
*/
|
||||
getTraceBufferUsage(callback: Function): void;
|
||||
/**
|
||||
* @param callback Called every time the given event occurs on any process.
|
||||
*/
|
||||
setWatchEvent(categoryName: string, eventName: string, callback: Function): void;
|
||||
/**
|
||||
* Cancel the watch event. If tracing is enabled, this may race with the watch event callback.
|
||||
*/
|
||||
cancelWatchEvent(): void;
|
||||
DEFAULT_OPTIONS: number;
|
||||
ENABLE_SYSTRACE: number;
|
||||
ENABLE_SAMPLING: number;
|
||||
RECORD_CONTINUOUSLY: number;
|
||||
}
|
||||
|
||||
interface Dialog {
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns an array of file paths chosen by the user,
|
||||
* otherwise returns undefined.
|
||||
*/
|
||||
showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog;
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns the path of file chosen by the user, otherwise
|
||||
* returns undefined.
|
||||
*/
|
||||
showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog;
|
||||
/**
|
||||
* Shows a message box. It will block until the message box is closed. It returns .
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns The index of the clicked button.
|
||||
*/
|
||||
showMessageBox: typeof GitHubElectron.Dialog.showMessageBox;
|
||||
|
||||
/**
|
||||
* Runs a modal dialog that shows an error message. This API can be called safely
|
||||
* before the ready event of app module emits, it is usually used to report errors
|
||||
* in early stage of startup.
|
||||
*/
|
||||
showErrorBox(title: string, content: string): void;
|
||||
}
|
||||
|
||||
interface GlobalShortcut {
|
||||
/**
|
||||
* Registers a global shortcut of accelerator.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @param callback Called when the registered shortcut is pressed by the user.
|
||||
* @returns {}
|
||||
*/
|
||||
register(accelerator: string, callback: Function): void;
|
||||
/**
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @returns Whether the accelerator is registered.
|
||||
*/
|
||||
isRegistered(accelerator: string): boolean;
|
||||
/**
|
||||
* Unregisters the global shortcut of keycode.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
*/
|
||||
unregister(accelerator: string): void;
|
||||
/**
|
||||
* Unregisters all the global shortcuts.
|
||||
*/
|
||||
unregisterAll(): void;
|
||||
}
|
||||
|
||||
class RequestFileJob {
|
||||
/**
|
||||
* Create a request job which would query a file of path and set corresponding mime types.
|
||||
*/
|
||||
constructor(path: string);
|
||||
}
|
||||
|
||||
class RequestStringJob {
|
||||
/**
|
||||
* Create a request job which sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "text/plain".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
charset?: string;
|
||||
data?: string;
|
||||
});
|
||||
}
|
||||
|
||||
class RequestBufferJob {
|
||||
/**
|
||||
* Create a request job which accepts a buffer and sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "application/octet-stream".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
encoding?: string;
|
||||
data?: Buffer;
|
||||
});
|
||||
}
|
||||
|
||||
interface Protocol {
|
||||
registerProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
unregisterProtocol(scheme: string): void;
|
||||
isHandledProtocol(scheme: string): boolean;
|
||||
interceptProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
uninterceptProtocol(scheme: string): void;
|
||||
RequestFileJob: typeof RequestFileJob;
|
||||
RequestStringJob: typeof RequestStringJob;
|
||||
RequestBufferJob: typeof RequestBufferJob;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'app' {
|
||||
var _app: GitHubElectron.App;
|
||||
export = _app;
|
||||
@@ -21,138 +210,18 @@ declare module 'browser-window' {
|
||||
}
|
||||
|
||||
declare module 'content-tracing' {
|
||||
/**
|
||||
* Get a set of category groups. The category groups can change as new code paths are reached.
|
||||
* @param callback Called once all child processes have acked to the getCategories request.
|
||||
*/
|
||||
export function getCategories(callback: (categoryGroups: any[]) => void): void;
|
||||
/**
|
||||
* Start recording on all processes. Recording begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the EnableRecording request.
|
||||
* @param categoryFilter A filter to control what category groups should be traced.
|
||||
* A filter can have an optional "-" prefix to exclude category groups that contain
|
||||
* a matching category. Having both included and excluded category patterns in the
|
||||
* same list would not be supported.
|
||||
* @param options controls what kind of tracing is enabled, it could be a OR-ed
|
||||
* combination of tracing.DEFAULT_OPTIONS, tracing.ENABLE_SYSTRACE, tracing.ENABLE_SAMPLING
|
||||
* and tracing.RECORD_CONTINUOUSLY.
|
||||
* @param callback Called once all child processes have acked to the startRecording request.
|
||||
*/
|
||||
export function startRecording(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop recording on all processes. Child processes typically are caching trace data and
|
||||
* only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid
|
||||
* much runtime overhead of tracing. So, to end tracing, we must asynchronously ask all
|
||||
* child processes to flush any pending trace data.
|
||||
* @param resultFilePath Trace data will be written into this file if it is not empty,
|
||||
* or into a temporary file.
|
||||
* @param callback Called once all child processes have acked to the stopRecording request.
|
||||
*/
|
||||
export function stopRecording(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data.
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Start monitoring on all processes. Monitoring begins immediately locally, and asynchronously
|
||||
* on child processes as soon as they receive the startMonitoring request.
|
||||
* @param callback Called once all child processes have acked to the startMonitoring request.
|
||||
*/
|
||||
export function startMonitoring(categoryFilter: string, options: number, callback: Function): void;
|
||||
/**
|
||||
* Stop monitoring on all processes.
|
||||
* @param callback Called once all child processes have acked to the stopMonitoring request.
|
||||
*/
|
||||
export function stopMonitoring(callback: Function): void;
|
||||
/**
|
||||
* Get the current monitoring traced data. Child processes typically are caching trace data
|
||||
* and only rarely flush and send trace data back to the main process. That is because it may
|
||||
* be an expensive operation to send the trace data over IPC, and we would like to avoid much
|
||||
* runtime overhead of tracing. So, to end tracing, we must asynchronously ask all child
|
||||
* processes to flush any pending trace data.
|
||||
* @param callback Called once all child processes have acked to the captureMonitoringSnapshot request.
|
||||
*/
|
||||
export function captureMonitoringSnapshot(resultFilePath: string, callback:
|
||||
/**
|
||||
* @param filePath A file that contains the traced data
|
||||
* @returns {}
|
||||
*/
|
||||
(filePath: string) => void
|
||||
): void;
|
||||
/**
|
||||
* Get the maximum across processes of trace buffer percent full state.
|
||||
* @param callback Called when the TraceBufferUsage value is determined.
|
||||
*/
|
||||
export function getTraceBufferUsage(callback: Function): void;
|
||||
/**
|
||||
* @param callback Called every time the given event occurs on any process.
|
||||
*/
|
||||
export function setWatchEvent(categoryName: string, eventName: string, callback: Function): void;
|
||||
/**
|
||||
* Cancel the watch event. If tracing is enabled, this may race with the watch event callback.
|
||||
*/
|
||||
export function cancelWatchEvent(): void;
|
||||
export var DEFAULT_OPTIONS: number;
|
||||
export var ENABLE_SYSTRACE: number;
|
||||
export var ENABLE_SAMPLING: number;
|
||||
export var RECORD_CONTINUOUSLY: number;
|
||||
var contentTracing: GitHubElectron.ContentTracing
|
||||
export = contentTracing;
|
||||
}
|
||||
|
||||
declare module 'dialog' {
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns an array of file paths chosen by the user,
|
||||
* otherwise returns undefined.
|
||||
*/
|
||||
export var showOpenDialog: typeof GitHubElectron.Dialog.showOpenDialog;
|
||||
/**
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns On success, returns the path of file chosen by the user, otherwise
|
||||
* returns undefined.
|
||||
*/
|
||||
export var showSaveDialog: typeof GitHubElectron.Dialog.showSaveDialog;
|
||||
/**
|
||||
* Shows a message box. It will block until the message box is closed. It returns .
|
||||
* @param callback If supplied, the API call will be asynchronous.
|
||||
* @returns The index of the clicked button.
|
||||
*/
|
||||
export var showMessageBox: typeof GitHubElectron.Dialog.showMessageBox;
|
||||
|
||||
/**
|
||||
* Runs a modal dialog that shows an error message. This API can be called safely
|
||||
* before the ready event of app module emits, it is usually used to report errors
|
||||
* in early stage of startup.
|
||||
*/
|
||||
export function showErrorBox(title: string, content: string): void;
|
||||
var dialog: GitHubElectron.Dialog
|
||||
export = dialog;
|
||||
}
|
||||
|
||||
declare module 'global-shortcut' {
|
||||
/**
|
||||
* Registers a global shortcut of accelerator.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @param callback Called when the registered shortcut is pressed by the user.
|
||||
* @returns {}
|
||||
*/
|
||||
export function register(accelerator: string, callback: Function): void;
|
||||
/**
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
* @returns Whether the accelerator is registered.
|
||||
*/
|
||||
export function isRegistered(accelerator: string): boolean;
|
||||
/**
|
||||
* Unregisters the global shortcut of keycode.
|
||||
* @param accelerator Represents a keyboard shortcut. It can contain modifiers
|
||||
* and key codes, combined by the "+" character.
|
||||
*/
|
||||
export function unregister(accelerator: string): void;
|
||||
/**
|
||||
* Unregisters all the global shortcuts.
|
||||
*/
|
||||
export function unregisterAll(): void;
|
||||
var globalShortcut: GitHubElectron.GlobalShortcut;
|
||||
export = globalShortcut;
|
||||
}
|
||||
|
||||
declare module 'ipc' {
|
||||
@@ -176,52 +245,26 @@ declare module 'power-monitor' {
|
||||
}
|
||||
|
||||
declare module 'protocol' {
|
||||
export function registerProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
export function unregisterProtocol(scheme: string): void;
|
||||
export function isHandledProtocol(scheme: string): boolean;
|
||||
export function interceptProtocol(scheme: string, handler: (request: any) => void): void;
|
||||
export function uninterceptProtocol(scheme: string): void;
|
||||
export class RequestFileJob {
|
||||
/**
|
||||
* Create a request job which would query a file of path and set corresponding mime types.
|
||||
*/
|
||||
constructor(path: string);
|
||||
}
|
||||
export class RequestStringJob {
|
||||
/**
|
||||
* Create a request job which sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "text/plain".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
charset?: string;
|
||||
data?: string;
|
||||
});
|
||||
}
|
||||
export class RequestBufferJob {
|
||||
/**
|
||||
* Create a request job which accepts a buffer and sends a string as response.
|
||||
*/
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default is "application/octet-stream".
|
||||
*/
|
||||
mimeType?: string;
|
||||
/**
|
||||
* Default is "UTF-8".
|
||||
*/
|
||||
encoding?: string;
|
||||
data?: Buffer;
|
||||
});
|
||||
}
|
||||
var protocol: GitHubElectron.Protocol;
|
||||
export = protocol;
|
||||
}
|
||||
|
||||
declare module 'tray' {
|
||||
var Tray: typeof GitHubElectron.Tray;
|
||||
export = Tray;
|
||||
}
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(id: 'app'): GitHubElectron.App
|
||||
(id: 'auto-updater'): GitHubElectron.AutoUpdater
|
||||
(id: 'browser-window'): typeof GitHubElectron.BrowserWindow
|
||||
(id: 'content-tracing'): GitHubElectron.ContentTracing
|
||||
(id: 'dialog'): GitHubElectron.Dialog
|
||||
(id: 'global-shortcut'): GitHubElectron.GlobalShortcut
|
||||
(id: 'ipc'): NodeJS.EventEmitter
|
||||
(id: 'menu'): typeof GitHubElectron.Menu
|
||||
(id: 'menu-item'): typeof GitHubElectron.MenuItem
|
||||
(id: 'power-monitor'): NodeJS.EventEmitter
|
||||
(id: 'protocol'): GitHubElectron.Protocol
|
||||
(id: 'tray'): typeof GitHubElectron.Tray
|
||||
}
|
||||
|
||||
+69
-58
@@ -1,4 +1,4 @@
|
||||
// Type definitions for the Electron 0.25.2 renderer process (web page)
|
||||
// Type definitions for the Electron 0.25.2 renderer process (web page)
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -6,8 +6,7 @@
|
||||
/// <reference path="./github-electron.d.ts" />
|
||||
|
||||
declare module GitHubElectron {
|
||||
|
||||
class InProcess implements NodeJS.EventEmitter {
|
||||
export class InProcess implements NodeJS.EventEmitter {
|
||||
addListener(event: string, listener: Function): InProcess;
|
||||
on(event: string, listener: Function): InProcess;
|
||||
once(event: string, listener: Function): InProcess;
|
||||
@@ -37,69 +36,81 @@ declare module GitHubElectron {
|
||||
sendToHost(channel: string, ...args: any[]): void;
|
||||
}
|
||||
|
||||
module Remote {
|
||||
export function getCurrentWindow(): BrowserWindow;
|
||||
interface Remote {
|
||||
/**
|
||||
* @returns The object returned by require(module) in the main process.
|
||||
*/
|
||||
require(module: string): any;
|
||||
/**
|
||||
* @returns The BrowserWindow object which this web page belongs to.
|
||||
*/
|
||||
getCurrentWindow(): BrowserWindow
|
||||
/**
|
||||
* @returns The global variable of name (e.g. global[name]) in the main process.
|
||||
*/
|
||||
getGlobal(name: string): any;
|
||||
/**
|
||||
* Returns the process object in the main process. This is the same as
|
||||
* remote.getGlobal('process'), but gets cached.
|
||||
*/
|
||||
process: any;
|
||||
}
|
||||
|
||||
interface WebFrame {
|
||||
/**
|
||||
* Changes the zoom factor to the specified factor, zoom factor is
|
||||
* zoom percent / 100, so 300% = 3.0.
|
||||
*/
|
||||
setZoomFactor(factor: number): void;
|
||||
/**
|
||||
* @returns The current zoom factor.
|
||||
*/
|
||||
getZoomFactor(): number;
|
||||
/**
|
||||
* Changes the zoom level to the specified level, 0 is "original size", and each
|
||||
* increment above or below represents zooming 20% larger or smaller to default
|
||||
* limits of 300% and 50% of original size, respectively.
|
||||
*/
|
||||
setZoomLevel(level: number): void;
|
||||
/**
|
||||
* @returns The current zoom level.
|
||||
*/
|
||||
getZoomLevel(): number;
|
||||
/**
|
||||
* Sets a provider for spell checking in input fields and text areas.
|
||||
*/
|
||||
setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: {
|
||||
/**
|
||||
* @returns Whether the word passed is correctly spelled.
|
||||
*/
|
||||
spellCheck: (text: string) => boolean;
|
||||
}): void;
|
||||
/**
|
||||
* Sets the scheme as secure scheme. Secure schemes do not trigger mixed content
|
||||
* warnings. For example, https and data are secure schemes because they cannot be
|
||||
* corrupted by active network attackers.
|
||||
*/
|
||||
registerUrlSchemeAsSecure(scheme: string): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'ipc' {
|
||||
var InProcess: GitHubElectron.InProcess;
|
||||
export = InProcess;
|
||||
var inProcess: GitHubElectron.InProcess;
|
||||
export = inProcess;
|
||||
}
|
||||
|
||||
declare module 'remote' {
|
||||
/**
|
||||
* @returns The object returned by require(module) in the main process.
|
||||
*/
|
||||
export function require(module: string): any;
|
||||
/**
|
||||
* @returns The BrowserWindow object which this web page belongs to.
|
||||
*/
|
||||
export var getCurrentWindow: typeof GitHubElectron.Remote.getCurrentWindow;
|
||||
/**
|
||||
* @returns The global variable of name (e.g. global[name]) in the main process.
|
||||
*/
|
||||
export function getGlobal(name: string): any;
|
||||
/**
|
||||
* Returns the process object in the main process. This is the same as
|
||||
* remote.getGlobal('process'), but gets cached.
|
||||
*/
|
||||
export var process: any;
|
||||
var remote: GitHubElectron.Remote;
|
||||
export = remote;
|
||||
}
|
||||
|
||||
declare module 'web-frame' {
|
||||
/**
|
||||
* Changes the zoom factor to the specified factor, zoom factor is
|
||||
* zoom percent / 100, so 300% = 3.0.
|
||||
*/
|
||||
export function setZoomFactor(factor: number): void;
|
||||
/**
|
||||
* @returns The current zoom factor.
|
||||
*/
|
||||
export function getZoomFactor(): number;
|
||||
/**
|
||||
* Changes the zoom level to the specified level, 0 is "original size", and each
|
||||
* increment above or below represents zooming 20% larger or smaller to default
|
||||
* limits of 300% and 50% of original size, respectively.
|
||||
*/
|
||||
export function setZoomLevel(level: number): void;
|
||||
/**
|
||||
* @returns The current zoom level.
|
||||
*/
|
||||
export function getZoomLevel(): number;
|
||||
/**
|
||||
* Sets a provider for spell checking in input fields and text areas.
|
||||
*/
|
||||
export function setSpellCheckProvider(language: string, autoCorrectWord: boolean, provider: {
|
||||
/**
|
||||
* @returns Whether the word passed is correctly spelled.
|
||||
*/
|
||||
spellCheck: (text: string) => boolean;
|
||||
}): void;
|
||||
/**
|
||||
* Sets the scheme as secure scheme. Secure schemes do not trigger mixed content
|
||||
* warnings. For example, https and data are secure schemes because they cannot be
|
||||
* corrupted by active network attackers.
|
||||
*/
|
||||
export function registerUrlSchemeAsSecure(scheme: string): void;
|
||||
var webframe: GitHubElectron.WebFrame;
|
||||
export = webframe;
|
||||
}
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(id: 'ipc'): GitHubElectron.InProcess
|
||||
(id: 'remote'): GitHubElectron.Remote
|
||||
(id: 'web-frame'): GitHubElectron.WebFrame
|
||||
}
|
||||
|
||||
Vendored
+126
-101
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Electron 0.25.2 (shared between main and rederer processes)
|
||||
// Type definitions for Electron 0.25.2 (shared between main and rederer processes)
|
||||
// Project: http://electron.atom.io/
|
||||
// Definitions by: jedmao <https://github.com/jedmao/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -1131,123 +1131,159 @@ declare module GitHubElectron {
|
||||
*/
|
||||
setContextMenu(menu: Menu): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'clipboard' {
|
||||
/**
|
||||
* @returns The contents of the clipboard as plain text.
|
||||
*/
|
||||
export function readText(type?: string): string;
|
||||
/**
|
||||
* Writes the text into the clipboard as plain text.
|
||||
*/
|
||||
export function writeText(text: string, type?: string): void;
|
||||
/**
|
||||
* @returns The contents of the clipboard as a NativeImage.
|
||||
*/
|
||||
export var readImage: typeof GitHubElectron.Clipboard.readImage;
|
||||
/**
|
||||
* Writes the image into the clipboard.
|
||||
*/
|
||||
export var writeImage: typeof GitHubElectron.Clipboard.writeImage;
|
||||
/**
|
||||
* Clears everything in clipboard.
|
||||
*/
|
||||
export function clear(type?: string): void;
|
||||
/**
|
||||
* Note: This API is experimental and could be removed in future.
|
||||
* @returns Whether the clipboard has data in the specified format.
|
||||
*/
|
||||
export function has(format: string, type?: string): boolean;
|
||||
/**
|
||||
* Reads the data in the clipboard of the specified format.
|
||||
* Note: This API is experimental and could be removed in future.
|
||||
*/
|
||||
export function read(format: string, type?: string): any;
|
||||
}
|
||||
|
||||
declare module 'crash-reporter' {
|
||||
export function start(options?: {
|
||||
interface Clipboard {
|
||||
/**
|
||||
* Default: Electron
|
||||
* @returns The contents of the clipboard as plain text.
|
||||
*/
|
||||
readText(type?: string): string;
|
||||
/**
|
||||
* Writes the text into the clipboard as plain text.
|
||||
*/
|
||||
writeText(text: string, type?: string): void;
|
||||
/**
|
||||
* @returns The contents of the clipboard as a NativeImage.
|
||||
*/
|
||||
readImage: typeof GitHubElectron.Clipboard.readImage;
|
||||
/**
|
||||
* Writes the image into the clipboard.
|
||||
*/
|
||||
writeImage: typeof GitHubElectron.Clipboard.writeImage;
|
||||
/**
|
||||
* Clears everything in clipboard.
|
||||
*/
|
||||
clear(type?: string): void;
|
||||
/**
|
||||
* Note: This API is experimental and could be removed in future.
|
||||
* @returns Whether the clipboard has data in the specified format.
|
||||
*/
|
||||
has(format: string, type?: string): boolean;
|
||||
/**
|
||||
* Reads the data in the clipboard of the specified format.
|
||||
* Note: This API is experimental and could be removed in future.
|
||||
*/
|
||||
read(format: string, type?: string): any;
|
||||
}
|
||||
|
||||
interface CrashReporterStartOptions {
|
||||
/**
|
||||
* Default: Electron
|
||||
*/
|
||||
productName?: string;
|
||||
/**
|
||||
* Default: GitHub, Inc.
|
||||
*/
|
||||
* Default: GitHub, Inc.
|
||||
*/
|
||||
companyName?: string;
|
||||
/**
|
||||
* URL that crash reports would be sent to as POST.
|
||||
* Default: http://54.249.141.255:1127/post
|
||||
*/
|
||||
* URL that crash reports would be sent to as POST.
|
||||
* Default: http://54.249.141.255:1127/post
|
||||
*/
|
||||
submitUrl?: string;
|
||||
/**
|
||||
* Send the crash report without user interaction.
|
||||
* Default: true.
|
||||
*/
|
||||
* Send the crash report without user interaction.
|
||||
* Default: true.
|
||||
*/
|
||||
autoSubmit?: boolean;
|
||||
/**
|
||||
* Default: false.
|
||||
*/
|
||||
* Default: false.
|
||||
*/
|
||||
ignoreSystemCrashHandler?: boolean;
|
||||
/**
|
||||
* An object you can define which content will be send along with the report.
|
||||
* Only string properties are send correctly.
|
||||
* Nested objects are not supported.
|
||||
*/
|
||||
* An object you can define which content will be send along with the report.
|
||||
* Only string properties are send correctly.
|
||||
* Nested objects are not supported.
|
||||
*/
|
||||
extra?: {}
|
||||
}): void;
|
||||
|
||||
/**
|
||||
* @returns The date and ID of the last crash report. When there was no crash report
|
||||
* sent or the crash reporter is not started, null will be returned.
|
||||
*/
|
||||
export function getLastCrashReport(): CrashReporterPayload;
|
||||
|
||||
}
|
||||
|
||||
interface CrashReporterPayload extends Object {
|
||||
/**
|
||||
* E.g., "electron-crash-service".
|
||||
*/
|
||||
* E.g., "electron-crash-service".
|
||||
*/
|
||||
rept: string;
|
||||
/**
|
||||
* The version of Electron.
|
||||
*/
|
||||
* The version of Electron.
|
||||
*/
|
||||
ver: string;
|
||||
/**
|
||||
* E.g., "win32".
|
||||
*/
|
||||
* E.g., "win32".
|
||||
*/
|
||||
platform: string;
|
||||
/**
|
||||
* E.g., "renderer".
|
||||
*/
|
||||
* E.g., "renderer".
|
||||
*/
|
||||
process_type: string;
|
||||
ptime: number;
|
||||
/**
|
||||
* The version in package.json.
|
||||
*/
|
||||
* The version in package.json.
|
||||
*/
|
||||
_version: string;
|
||||
/**
|
||||
* The product name in the crashReporter options object.
|
||||
*/
|
||||
* The product name in the crashReporter options object.
|
||||
*/
|
||||
_productName: string;
|
||||
/**
|
||||
* Name of the underlying product. In this case, Electron.
|
||||
*/
|
||||
* Name of the underlying product. In this case, Electron.
|
||||
*/
|
||||
prod: string;
|
||||
/**
|
||||
* The company name in the crashReporter options object.
|
||||
*/
|
||||
* The company name in the crashReporter options object.
|
||||
*/
|
||||
_companyName: string;
|
||||
/**
|
||||
* The crashreporter as a file.
|
||||
*/
|
||||
* The crashreporter as a file.
|
||||
*/
|
||||
upload_file_minidump: File;
|
||||
}
|
||||
|
||||
interface CrashReporter {
|
||||
start(options?: CrashReporterStartOptions): void;
|
||||
|
||||
/**
|
||||
* @returns The date and ID of the last crash report. When there was no crash report
|
||||
* sent or the crash reporter is not started, null will be returned.
|
||||
*/
|
||||
getLastCrashReport(): CrashReporterPayload;
|
||||
}
|
||||
|
||||
interface Shell{
|
||||
/**
|
||||
* Show the given file in a file manager. If possible, select the file.
|
||||
*/
|
||||
showItemInFolder(fullPath: string): void;
|
||||
/**
|
||||
* Open the given file in the desktop's default manner.
|
||||
*/
|
||||
openItem(fullPath: string): void;
|
||||
/**
|
||||
* Open the given external protocol URL in the desktop's default manner
|
||||
* (e.g., mailto: URLs in the default mail user agent).
|
||||
*/
|
||||
openExternal(url: string): void;
|
||||
/**
|
||||
* Move the given file to trash and returns boolean status for the operation.
|
||||
*/
|
||||
moveItemToTrash(fullPath: string): void;
|
||||
/**
|
||||
* Play the beep sound.
|
||||
*/
|
||||
beep(): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'clipboard' {
|
||||
var clipboard: GitHubElectron.Clipboard
|
||||
export = clipboard;
|
||||
}
|
||||
|
||||
declare module 'crash-reporter' {
|
||||
var crashReporter: GitHubElectron.CrashReporter
|
||||
export = crashReporter;
|
||||
}
|
||||
|
||||
declare module 'native-image' {
|
||||
var NativeImage: typeof GitHubElectron.NativeImage;
|
||||
export = NativeImage;
|
||||
var nativeImage: typeof GitHubElectron.NativeImage;
|
||||
export = nativeImage;
|
||||
}
|
||||
|
||||
declare module 'screen' {
|
||||
@@ -1256,27 +1292,8 @@ declare module 'screen' {
|
||||
}
|
||||
|
||||
declare module 'shell' {
|
||||
/**
|
||||
* Show the given file in a file manager. If possible, select the file.
|
||||
*/
|
||||
export function showItemInFolder(fullPath: string): void;
|
||||
/**
|
||||
* Open the given file in the desktop's default manner.
|
||||
*/
|
||||
export function openItem(fullPath: string): void;
|
||||
/**
|
||||
* Open the given external protocol URL in the desktop's default manner
|
||||
* (e.g., mailto: URLs in the default mail user agent).
|
||||
*/
|
||||
export function openExternal(url: string): void;
|
||||
/**
|
||||
* Move the given file to trash and returns boolean status for the operation.
|
||||
*/
|
||||
export function moveItemToTrash(fullPath: string): void;
|
||||
/**
|
||||
* Play the beep sound.
|
||||
*/
|
||||
export function beep(): void;
|
||||
var shell: GitHubElectron.Shell;
|
||||
export = shell;
|
||||
}
|
||||
|
||||
interface Window {
|
||||
@@ -1293,3 +1310,11 @@ interface File {
|
||||
*/
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface NodeRequireFunction {
|
||||
(id: 'clipboard'): GitHubElectron.Clipboard
|
||||
(id: 'crash-reporter'): GitHubElectron.CrashReporter
|
||||
(id: 'native-image'): typeof GitHubElectron.NativeImage
|
||||
(id: 'screen'): GitHubElectron.Screen
|
||||
(id: 'shell'): GitHubElectron.Shell
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user