-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathindex.js
41 lines (33 loc) · 992 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
const app = require('app');
const globalShortcut = require('global-shortcut');
const BrowserWindow = require('browser-window');
const isOSX = process.platform === 'darwin';
function devTools() {
var win = BrowserWindow.getFocusedWindow();
if (win) {
win.toggleDevTools();
}
}
function refresh() {
var win = BrowserWindow.getFocusedWindow();
if (win) {
win.reloadIgnoringCache();
}
}
module.exports = function () {
app.on('ready', function () {
app.on('browser-window-focus', function () {
globalShortcut.register(isOSX ? 'Cmd+Alt+I' : 'Ctrl+Shift+I', devTools);
globalShortcut.register('F12', devTools);
globalShortcut.register('CmdOrCtrl+R', refresh);
globalShortcut.register('F5', refresh);
});
app.on('browser-window-blur', function () {
globalShortcut.unregister(isOSX ? 'Cmd+Alt+I' : 'Ctrl+Shift+I');
globalShortcut.unregister('F12');
globalShortcut.unregister('CmdOrCtrl+R');
globalShortcut.unregister('F5');
});
});
};