/* #Node.js */
//アプリケーションを制御し、ネイティブなブラウザウィンドウを作成するモジュール
-const { app, BrowserWindow, Notification } = require('electron')
+const { app, BrowserWindow, Notification, globalShortcut } = require('electron')
const path = require('path')
+let window
function createWindow() {
//ブラウザウィンドウを作成します。
- const win = new BrowserWindow({
+ window = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
-
//アプリのindex.htmlを読み込みます。
- win.loadFile('index.html')
+ window.loadFile('index.html')
}
function showNotification() {
// このメソッドは、Electronが初期化を終え、ブラウザウィンドウを作成する準備ができたときに呼び出されます。
// 初期化が完了し、ブラウザウィンドウを作成する準備ができたときに呼び出されます。
// いくつかのAPIは、このイベントが発生した後にのみ使用できます。
-app.whenReady().then(() => {
+app.whenReady().then(() => {/*
+ globalShortcut.register('CommandOrControl+Shift+I', () => {
+ console.log('Devtool Block')
+ })//*/
+}).then(() => {
createWindow()// <-- function createWindow のやつを動かす。
+ window.setProgressBar(0.555555555555,{mode:"paused"})
+ setTimeout(() => {
+ window.setProgressBar(0)
+ setTimeout(() => {
+ window.setProgressBar(0.2)
+ setTimeout(() => {
+ window.setProgressBar(0.25)
+ setTimeout(() => {
+ window.setProgressBar(0.3,{mode:"error"})
+ setTimeout(() => {
+ window.setProgressBar(0.9)
+ setTimeout(() => {
+ window.setProgressBar(0.99)
+ setTimeout(() => {
+ window.setProgressBar(1)
+ setTimeout(() => {
+ window.setProgressBar(-1)
+ setTimeout(() => {
+ window.setProgressBar(2)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+ }, 2000)
+
// このリスナーは、アプリケーションが起動した後に動きます。
app.on('activate', () => {
- // 表示されているウィンドウがないときにのみ動きます。
+ // 表示されているウィンドウがないときにのみ動きます。(バックグラウンド処理など)
+ /*
if (BrowserWindow.getAllWindows().length === 0) {
// 新しいブラウザウィンドウを作成します。
createWindow()
}
-
+ //*/
})
+
}).then(() => {
showNotification()
})