2 //アプリケーションを制御し、ネイティブなブラウザウィンドウを作成するモジュール
3 const { app, BrowserWindow, Notification, globalShortcut } = require('electron')
4 const path = require('path')
7 function createWindow() {
9 window = new BrowserWindow({
13 preload: path.join(__dirname, 'preload.js')
16 //アプリのindex.htmlを読み込みます。
17 window.loadFile('index.html')
20 function showNotification() {
22 const notification = {
23 title: 'Basic Notification',
24 body: 'Notification from the Main process'
26 new Notification(notification).show()
29 // このメソッドは、Electronが初期化を終え、ブラウザウィンドウを作成する準備ができたときに呼び出されます。
30 // 初期化が完了し、ブラウザウィンドウを作成する準備ができたときに呼び出されます。
31 // いくつかのAPIは、このイベントが発生した後にのみ使用できます。
32 app.whenReady().then(() => {/*
33 globalShortcut.register('CommandOrControl+Shift+I', () => {
34 console.log('Devtool Block')
37 createWindow()// <-- function createWindow のやつを動かす。
39 window.setProgressBar(0.555555555555,{mode:"paused"})
41 window.setProgressBar(0)
43 window.setProgressBar(0.2)
45 window.setProgressBar(0.25)
47 window.setProgressBar(0.3,{mode:"error"})
49 window.setProgressBar(0.9)
51 window.setProgressBar(0.99)
53 window.setProgressBar(1)
55 window.setProgressBar(-1)
57 window.setProgressBar(2)
68 // このリスナーは、アプリケーションが起動した後に動きます。
69 app.on('activate', () => {
71 // 表示されているウィンドウがないときにのみ動きます。(バックグラウンド処理など)
73 if (BrowserWindow.getAllWindows().length === 0) {
74 // 新しいブラウザウィンドウを作成します。
84 // 開いているウィンドウがなくなったときにのみ動きます。
85 // !このリスナーは、macOSではOSのウィンドウ管理の動作のため、使用できません。
86 // !macOSでは、ユーザーがCmd + Qで明示的に終了させるまで、アプリケーションとそのメニューバーがアクティブなままであることが一般的です。
87 // !(余談:Neko7soraは、macを持っていないため詳しく分かりません。以上....)
88 app.on('window-all-closed', () => {
89 if (process.platform !== 'darwin') {
96 require("./plugin/NavigatorOnLine/index.js")(app, BrowserWindow);