OSDN Git Service

README訂正
authorNeko7sora <75793267+Neko7sora@users.noreply.github.com>
Thu, 6 May 2021 12:54:57 +0000 (21:54 +0900)
committerNeko7sora <75793267+Neko7sora@users.noreply.github.com>
Thu, 6 May 2021 12:54:57 +0000 (21:54 +0900)
README.md
src/main.js
src/plugin/OnlineStatus/renderer.js [new file with mode: 0644]
src/renderer.js

index 1b66f8f..ba2f33d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ HTML5コメントジェネレーター(Re)
 ## プログラム作成条件
 1. HTML5コメントジェネレーター、HTML5コメントジェネレーター改に、
 
-    **「なるべく、相互性のあるものにする」**
+    **「なるべく、互換性のあるものにする」**
 
     なるべくだから100%ではなくてもいいよ!!
 
index c7bfdbb..0b15778 100644 (file)
@@ -1,20 +1,20 @@
 /* #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() {
@@ -29,19 +29,54 @@ 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()
 })
diff --git a/src/plugin/OnlineStatus/renderer.js b/src/plugin/OnlineStatus/renderer.js
new file mode 100644 (file)
index 0000000..6a30184
--- /dev/null
@@ -0,0 +1,7 @@
+/* #electron */
+const alertOnlineStatus = navigator.onLine ? 'online' : 'offline'
+
+new Notification('[ステータス] オンライン = インターネットに接続されています。', alertOnlineStatus)
+new Notification('[ステータス] オフライン = インターネットに接続されていません。', alertOnlineStatus)
+
+alertOnlineStatus()
\ No newline at end of file
index fa7853f..92795d2 100644 (file)
@@ -1,9 +1,11 @@
 /* #electron */
 // 通知のやつ
+/*
 const myNotification = new Notification('Title', {
     body: 'Notification from the Renderer process'
   })
   
   myNotification.onclick = () => {
     console.log('Notification clicked')
-  }
\ No newline at end of file
+  }
+*/
\ No newline at end of file