Mercurial > hg > Members > ryokka > 43slide-viewer
comparison index.js @ 0:12d9c981a5f4
add source
author | ryokka |
---|---|
date | Wed, 29 May 2019 18:53:44 +0900 |
parents | |
children | e3851f39ad5c |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:12d9c981a5f4 |
---|---|
1 "use strict"; | |
2 | |
3 const electron = require("electron"); | |
4 const app = electron.app; | |
5 const Menu = electron.Menu; | |
6 const BrowserWindow = electron.BrowserWindow; | |
7 let mainWindow; | |
8 let locate; | |
9 | |
10 // 全てのウィンドウが閉じたら終了 | |
11 app.on('window-all-closed', function() { | |
12 if (process.platform != 'darwin') { | |
13 app.quit(); | |
14 } | |
15 }); | |
16 | |
17 // app.on('open-file', function() { | |
18 | |
19 // }); | |
20 | |
21 // Electronの初期化完了後に実行 | |
22 app.on('ready', function() { | |
23 // メイン画面の表示。ウィンドウの幅、高さを指定できる | |
24 mainWindow = new BrowserWindow({ | |
25 width: 800, | |
26 height: 600, | |
27 maxWidth: 800, | |
28 maxHeight: 600, | |
29 disableAutoHideCursor: true, | |
30 resizable: true, | |
31 autoHideMenuBar: true, | |
32 frame: false, | |
33 webPreferences: {}, | |
34 }); | |
35 | |
36 var inmenu = [ | |
37 {submenu: [ | |
38 { role: 'quit',}, | |
39 ]}, | |
40 | |
41 {label: 'View', | |
42 submenu: [ | |
43 { role: 'minimize',}, | |
44 { role: 'zoomin',}, | |
45 { role: 'zoomout',}, | |
46 { role: 'togglefullscreen'}, | |
47 ]} | |
48 ]; | |
49 | |
50 const menu = Menu.buildFromTemplate(inmenu); | |
51 Menu.setApplicationMenu(menu); | |
52 | |
53 | |
54 locate = 'file://' + __dirname + '/index.html'; | |
55 // if (process.argv[2] !== undefined) { | |
56 // locate = process.argv[2]; | |
57 // } | |
58 | |
59 mainWindow.loadURL(locate); | |
60 // ウィンドウが閉じられたらアプリも終了 | |
61 mainWindow.on('closed', function() { | |
62 mainWindow = null; | |
63 }); | |
64 }); |