From 7f4a8573fa7abc8bfb3baa667129c0a3225174f0 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 6 Mar 2016 18:32:09 +0900 Subject: [PATCH 1/2] update executeJavaScript() API following Electron 0.36.10 --- github-electron/github-electron-main-tests.ts | 4 ++++ github-electron/github-electron.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index 5d3060e4b..f3abc40b9 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -106,6 +106,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 diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 6d4620f43..38f847a85 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -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. */ @@ -1592,7 +1592,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 From 5ad54b3e0b1734ea2dd361710fc401bd9fb89c46 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 6 Mar 2016 18:37:24 +0900 Subject: [PATCH 2/2] compliant fixes for errors by --target es6 --- github-electron/github-electron-main-tests.ts | 7 +++---- github-electron/github-electron-renderer-tests.ts | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index f3abc40b9..1662ea1e0 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -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 diff --git a/github-electron/github-electron-renderer-tests.ts b/github-electron/github-electron-renderer-tests.ts index 7ddd585a7..31bd5a32e 100644 --- a/github-electron/github-electron-renderer-tests.ts +++ b/github-electron/github-electron-renderer-tests.ts @@ -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