-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
34 lines (30 loc) · 1.05 KB
/
index.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
const path = require("path")
const {ipcMain} = require("electron")
module.exports = class TaskprogMain {
constructor(env) {
// Define plugin enviornment within the class
this.env = env
this.playing = null;
}
// Called when the backend is ready
onReady(win) {
ipcMain.on('wsapi-updatePlaybackState', (event, attributes) => {
if (attributes.status) {
try {
this.env.utils.getWindow().setProgressBar(attributes.currentPlaybackProgress)
} catch(e) {
console.log("[Plugin][Taskprog][Error]",e)
}
} else {
this.env.utils.getWindow().setProgressBar(-1)
}
})
console.log("[Plugin][Taskprog] Taskprog Backend Ready.")
}
// Called when the renderer is ready (app.init())
onRendererReady(win) {
console.debug("Renderer Ready Called")
// Load the frontend plugin
this.env.utils.loadJSFrontend(path.join(this.env.dir, "index.frontend.js"))
}
}