SIGN IN SIGN UP

The standalone app based on official debugger of React Native, and includes React Inspector / Redux DevTools

0 0 0 JavaScript
import path from 'path';
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
import { BrowserWindow, Menu, globalShortcut, dialog } from 'electron';
import Store from 'electron-store';
import autoUpdate from './update';
import { catchConsoleLogLink, removeUnecessaryTabs } from './devtools';
import { selectRNDebuggerWorkerContext } from '../app/utils/devtools';
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
import { readConfig, filePath as configFile } from './config';
const store = new Store();
const executeJavaScript = (win, script) => win.webContents.executeJavaScript(script);
export const checkWindowInfo = win => executeJavaScript(win, 'window.checkWindowInfo()');
const checkIsOpenInEditorEnabled = win => executeJavaScript(win, 'window.isOpenInEditorEnabled()');
const changeMenuItems = menus => {
const rootMenuItems = Menu.getApplicationMenu().items;
Object.entries(menus).forEach(([key, subMenu]) => {
const rootMenuItem = rootMenuItems.find(({ label }) => label === key);
if (!rootMenuItem || !rootMenuItem.submenu) return;
Object.entries(subMenu).forEach(([subKey, menuSet]) => {
const menuItem = rootMenuItem.submenu.items.find(({ label }) => label === subKey);
if (!menuItem) return;
Object.assign(menuItem, menuSet);
});
});
};
const invokeDevMethod = (win, name) =>
executeJavaScript(win, `window.invokeDevMethod && window.invokeDevMethod('${name}')`);
const registerKeyboradShortcut = win => {
const prefix = process.platform === 'darwin' ? 'Command' : 'Ctrl';
// If another window focused, register a new shortcut
if (globalShortcut.isRegistered(`${prefix}+R`) || globalShortcut.isRegistered(`${prefix}+I`)) {
globalShortcut.unregisterAll();
}
globalShortcut.register(`${prefix}+R`, () => invokeDevMethod(win, 'reload'));
globalShortcut.register(`${prefix}+I`, () => invokeDevMethod(win, 'toggleElementInspector'));
};
const unregisterKeyboradShortcut = () => globalShortcut.unregisterAll();
const registerShortcuts = async win => {
registerKeyboradShortcut(win);
changeMenuItems({
Debugger: {
'Stay in Front': {
checked: win.isAlwaysOnTop(),
},
'Enable Open in Editor for Console Log': {
checked: await checkIsOpenInEditorEnabled(win),
},
},
});
};
const minSize = 100;
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
export const createWindow = ({ iconPath, isPortSettingRequired, port }) => {
const { config, isConfigBroken, error } = readConfig();
if (isConfigBroken) {
dialog.showErrorBox(
'Root config error',
`Parse root config failed, please checkout \`${configFile}\`, the error trace:\n\n` +
`${error}\n\n` +
'RNDebugger will load default config instead. ' +
'You can click `Debugger` -> `Open Config File` in application menu.'
);
}
const winBounds = store.get('winBounds');
const increasePosition = BrowserWindow.getAllWindows().length * 10;
const { width, height } = winBounds || {};
const win = new BrowserWindow({
...winBounds,
width: width && width >= minSize ? width : 1024,
height: height && height >= minSize ? height : 750,
minWidth: minSize,
minHeight: minSize,
...(increasePosition && winBounds.x && winBounds.y
? {
x: winBounds.x + increasePosition,
y: winBounds.y + increasePosition,
}
: {}),
backgroundColor: '#272c37',
tabbingIdentifier: 'rndebugger',
webPreferences: {
nodeIntegration: true,
},
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
...config.windowBounds,
});
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
const isFirstWindow = BrowserWindow.getAllWindows().length === 1;
const { timesJSLoadToRefreshDevTools = -1 } = config;
win.debuggerConfig = {
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
port,
editor: config.editor,
fontFamily: config.fontFamily,
defaultReactDevToolsTheme: config.defaultReactDevToolsTheme,
defaultReactDevToolsPort: config.defaultReactDevToolsPort,
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
networkInspect: config.defaultNetworkInspect && 1,
isPortSettingRequired: isPortSettingRequired && 1,
timesJSLoadToRefreshDevTools,
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
};
win.loadURL(`file://${path.resolve(__dirname)}/app.html`);
win.webContents.on('did-finish-load', () => {
win.webContents.zoomLevel = config.zoomLevel || store.get('zoomLevel', 0);
win.focus();
registerShortcuts(win);
if (process.env.E2E_TEST !== '1' && !isPortSettingRequired) {
win.openDevTools();
}
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
const checkUpdate = config.autoUpdate !== false;
if (checkUpdate && isFirstWindow) {
autoUpdate(iconPath);
}
});
win.webContents.on('devtools-opened', async () => {
const { location } = await checkWindowInfo(win);
catchConsoleLogLink(win, location.host, location.port);
v0.8.0 (#266) * Implement root config file in home directory (#165) * Add handle for read root config * Add openConfigFile method use for application menu * Add `Open config file` appliciation menu item * Comment window size in config template * Apply windowBounds, autoUpdate config * Apply defaultRNPakcagerPorts, defaultNetworkInspect config * Apply editor, defaultReactDevToolsTheme config * Use zoomLevel instead of fontSize * Add comment for defaultNetworkInspect config * Update test snapshot * Don't set EDITOR env if no config.editor * Show error message if config parse failed * Apply fontFamily, showAllDevToolsTab config * Update config template * Add documentation for config file * Comment fontFamily in config template * fix typos (#182) * Changed the type you're to you've (#185) * Remove Code Sponsor link * Add Open Collective links * Fix badges separation in README * Update docs/react-devtools-integration.md * Improve English (#193) The previous message was not grammatically correct. * Added support rndebugger-open for RN >= 0.53.0 (#198) * [NPM package] v0.3.16 * Update travis script * Update to node 9 on travis * Revert "Update travis script" This reverts commit 7593608966c643faedebe0595a70f6920963f88a. * Fix` rndebugger-open` injection with RN >= 0.53 again (#202) * Fix rndebugger-open inject with RN >= 0.53 again * Update snapshots * [NPM package] v0.3.17 * Fixed typo (#204) * fix grammatical improvements / add clarity to the network inspect docs. (#207) Also fixed a broken internal link to these docs from debugger integration * Add Delta patcher from react-native * Check Delta support on executeApplicationScript * Clear logs when check Delta support finished * Update check Delta support * E2E Test: Support file:// for fetch only on test * E2E test: Update expected logs * Update deltaUrlToBlobUrl.js from upstream * Add Open Collective link in Help * Update dependencies * v0.7.14 * Fix prod bundle by downgrade uglifyjs-webpack-plugin * v0.7.15 * Fix auto_updater.json * Check if Delta Bundler available (#215) * Check if Delta bundler available * Update E2E test * Clear logs even if no error catched * Fix Blob error for use `fetch` if Network Inspect enabled (#217) * Patch fetch code on applyDelta * Disable `support.blob` in `whatwg-fetch` for use native XMLHttpRequest * Don't check fetch code if it already patched * Check only if map type is delta * Update regex pattern * v0.7.16 * Send `callFunctionReturnFlushedQueue` event after waiting application script executed (#219) * Send `callFunctionReturnFlushedQueue` event after waiting application script executed * Fix lint error * Check scriptExecuted first * Toggle network inspect after define `support` var on patchFetchPolyfill (#220) * v0.7.17 * [update] Improve dialog wording slightly. (#221) * Ensure the initial script of `whatwg-fetch` is executed related to #209 * Patch all `whatwg-fetch` packages related to #209 * v0.7.18 * Fix error of blob function not found in whatwg-fetch with Network Inspect enabled * Fix typos (#238) * Update debugger from upstream (#240) * Update debugger from upstream https://github.com/facebook/react-native/commit/e5aa5b7c508c5e0e51f7abfcee350e27bef24ba2 * Upgrade Expo / RN versions in examples * Fix lint error * Fix worker didnt post message if checkDeltaAvailable failed * Remove unnecessary waitingScriptExecuted * set global.Blob to global.originalBlob before deleting global.Blob for rn > 0.54 compatability (#246) * Fix context menu functions for RN 0.56 (#247) * Fix patchFetchPolyfill for compatible RN 0.56 * Fix required modules of RNDebugger functions on RN 0.56 * Update docs/network-inspect-of-chrome-devtools.md * Update docs/debugger-integration.md * Update test fixture * Add more comments about Network Inspect manually setup * Lookup for react-native implementation * Assign global.$reactNative for make debug easier * Detect metroRequire for RN 0.56 * Update docs/debugger-integration.md * Bump electron version to 1.7.15 * Add the recently changes from redux-devtools-extension (#248) * Bump redux-devtools-instrument to v1.9 * Add actionCreators option for connect API * Update dependencies also downgrade redux to v3.7.2 because remotedev-app still using * Fix lint errors * v0.7.19 * Fix buildTestBundle of E2E tests * Fix ref issue of Draggable related to #250 * v0.7.20 * Update auto_updater.json * Fixes typo (#258) * update react-devtools-core for supporting react-profiler (#262) * Fix context menu functions on RN 0.57 (#263) * Use __r from RN >= 0.57 as metro require in debugger worker * Fix patchFetchPolyfill for RN 0.57 * Update docs/react-devtools-integration.md * v0.8.0
2018-09-29 18:32:42 +08:00
if (config.showAllDevToolsTab !== true) {
removeUnecessaryTabs(win);
}
selectRNDebuggerWorkerContext(win);
});
win.on('show', () => {
if (!win.isFocused()) return;
registerShortcuts(win);
});
win.on('focus', () => registerShortcuts(win));
win.on('restore', () => registerShortcuts(win));
win.on('hide', () => unregisterKeyboradShortcut());
win.on('blur', () => unregisterKeyboradShortcut());
win.on('minimize', () => unregisterKeyboradShortcut());
win.close = async () => {
unregisterKeyboradShortcut();
store.set('winBounds', win.getBounds());
store.set('zoomLevel', win.webContents.zoomLevel);
await executeJavaScript(win, 'window.beforeWindowClose && window.beforeWindowClose()');
win.destroy();
};
win.on('close', event => {
event.preventDefault();
win.close();
});
// https://github.com/electron/electron/issues/10442
win._setEscapeTouchBarItem = () => {}; // eslint-disable-line
return win;
};