-
Notifications
You must be signed in to change notification settings - Fork 60
/
main.js
39 lines (34 loc) · 758 Bytes
/
main.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
/**
* @file Fontmin App
* @author Firede <[email protected]>
*/
/**
* 初始化目录
*
* Mac 下 Edit/Window 目录需要初始化,否则复制粘贴快捷键无法调起
*/
function initMenu() {
var gui = require('nw.gui');
var win = gui.Window.get();
var nativeMenuBar = new gui.Menu({
type: 'menubar'
});
nativeMenuBar.createMacBuiltin('Fontmin');
win.menu = nativeMenuBar;
}
function preventDefault(evt) {
evt.preventDefault();
return false;
}
/**
* Main
*/
window.addEventListener('load', function () {
// only for mac
if (process.platform === 'darwin') {
initMenu();
}
// Prevent drag events
window.ondragover = preventDefault;
window.ondrop = preventDefault;
});