Restructure
This commit is contained in:
parent
2fc4005b6c
commit
bbcae012b8
1 changed files with 23 additions and 31 deletions
|
@ -2,18 +2,36 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
import {Store} from "./store";
|
||||
import {BrowserWindow as bw} from "./browserwindow";
|
||||
import {app, dialog, ipcMain, Notification, shell, BrowserWindow} from "electron";
|
||||
import {app, BrowserWindow, ipcMain} from "electron";
|
||||
import fetch from "electron-fetch";
|
||||
import {AppImageUpdater, NsisUpdater} from "electron-updater";
|
||||
import * as log from "electron-log";
|
||||
import ElectronStore from "electron-store";
|
||||
|
||||
export class utils {
|
||||
|
||||
/**
|
||||
* Playback Functions
|
||||
*/
|
||||
static playback = {
|
||||
pause: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.pause()")
|
||||
},
|
||||
play: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.play()")
|
||||
},
|
||||
playPause: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.playPause()")
|
||||
},
|
||||
next: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.next()")
|
||||
},
|
||||
previous: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Paths for the application to use
|
||||
*/
|
||||
private static paths: any = {
|
||||
static paths: any = {
|
||||
srcPath: path.join(__dirname, "../../src"),
|
||||
rendererPath: path.join(__dirname, "../../src/renderer"),
|
||||
mainPath: path.join(__dirname, "../../src/main"),
|
||||
|
@ -71,7 +89,7 @@ export class utils {
|
|||
} else {
|
||||
i18n = Object.assign(i18n, JSON.parse(fs.readFileSync(path.join(this.paths.i18nPath, `en_US.json`), "utf8")));
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
if (key) {
|
||||
return i18n[key]
|
||||
|
@ -97,7 +115,6 @@ export class utils {
|
|||
return Store.cfg.store
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the store instance
|
||||
* @returns {Store}
|
||||
|
@ -123,10 +140,6 @@ export class utils {
|
|||
return Store.pushToCloud
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the browser window
|
||||
*/
|
||||
|
@ -145,25 +158,4 @@ export class utils {
|
|||
static loadJSFrontend(path: string): void {
|
||||
bw.win.webContents.executeJavaScript(fs.readFileSync(path, "utf8"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Playback Functions
|
||||
*/
|
||||
static playback = {
|
||||
pause: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.pause()")
|
||||
},
|
||||
play: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.play()")
|
||||
},
|
||||
playPause: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.playPause()")
|
||||
},
|
||||
next: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.next()")
|
||||
},
|
||||
previous: () => {
|
||||
bw.win.webContents.executeJavaScript("MusicKitInterop.previous()")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue