mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
Merge pull request #8412 from rhysd/patch-4
github-electron: Improve executeJavaScript API following Electron v0.36.10 and compliant fixes
This commit is contained in:
@@ -16,12 +16,11 @@ import {
|
||||
crashReporter,
|
||||
nativeImage,
|
||||
screen,
|
||||
shell
|
||||
shell,
|
||||
hideInternalModules
|
||||
} from 'electron';
|
||||
|
||||
require('electron').hideInternalModules();
|
||||
|
||||
import path = require('path');
|
||||
import * as path from 'path';
|
||||
|
||||
// Quick start
|
||||
// https://github.com/atom/electron/blob/master/docs/tutorial/quick-start.md
|
||||
@@ -106,6 +105,10 @@ app.on('ready', () => {
|
||||
|
||||
mainWindow.printToPDF({}, (err, data) => {});
|
||||
mainWindow.webContents.printToPDF({}, (err, data) => {});
|
||||
|
||||
mainWindow.webContents.executeJavaScript('return true;');
|
||||
mainWindow.webContents.executeJavaScript('return true;', true);
|
||||
mainWindow.webContents.executeJavaScript('return true;', true, (result: boolean) => console.log(result));
|
||||
});
|
||||
|
||||
// Locale
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
shell
|
||||
} from 'electron';
|
||||
|
||||
import fs = require('fs');
|
||||
import * as fs from 'fs';
|
||||
|
||||
// In renderer process (web page).
|
||||
// https://github.com/atom/electron/blob/master/docs/api/ipc-renderer.md
|
||||
|
||||
4
github-electron/github-electron.d.ts
vendored
4
github-electron/github-electron.d.ts
vendored
@@ -636,7 +636,7 @@ declare module Electron {
|
||||
* Evaluates code in page.
|
||||
* @param code Code to evaluate.
|
||||
*/
|
||||
executeJavaScript(code: string): void;
|
||||
executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void;
|
||||
/**
|
||||
* Executes Edit -> Undo command in page.
|
||||
*/
|
||||
@@ -1597,7 +1597,7 @@ declare module Electron {
|
||||
* invoked by a gesture from the user. Setting `userGesture` to `true` will remove
|
||||
* this limitation.
|
||||
*/
|
||||
executeJavaScript(code: string, userGesture?: boolean): void;
|
||||
executeJavaScript(code: string, userGesture?: boolean, callback?: (result: any) => void): void;
|
||||
}
|
||||
|
||||
// Type definitions for main process
|
||||
|
||||
Reference in New Issue
Block a user