import { dialog, BrowserWindow } from 'electron';
-export default {
- loadURL: function (winId: number, url: string) {
- let window = BrowserWindow.fromId(winId);
- window.loadURL(url);
- },
+export const loadURL= function (winId: number, url: string) {
+ let window = BrowserWindow.fromId(winId);
+ window.loadURL(url);
+};
- showMessageBox: function (winId: number, options: Electron.MessageBoxOptions) {
- let window = BrowserWindow.fromId(winId);
- let showMessageBox = (dialog.showMessageBoxSync || dialog.showMessageBox);
- showMessageBox(window, options);
- },
+export const showMessageBox = function (winId: number, options: Electron.MessageBoxOptions) {
+ let window = BrowserWindow.fromId(winId);
+ let showMessageBox = (dialog.showMessageBoxSync || dialog.showMessageBox);
+ showMessageBox(window, options);
+};
- show: function (winId: number) {
- let window = BrowserWindow.fromId(winId);
- window.show();
- }
+export const show = function (winId: number) {
+ let window = BrowserWindow.fromId(winId);
+ window.show();
};
private activate(addon: AddonInfo) {
console.log('activate: ' + addon.path + ' name:' + addon.name);
+ if (!addon.activate)
+ return;
let addonInstance = this.getModule(addon);
if (addonInstance && addonInstance.activate)
addonInstance.activate();
}
isAddonAvailable() {
- return this.addonList.length != 0;
+ for (let addon of this.addonList) {
+ if (addon.activate)
+ return true;
+ }
+ return false;
}
emit(eventName: string, ...args: any[]) {