}, timeout, null);
}
}
+ _this.webApplication.finalize();
+ _this.webApplication = null;
});
app.on('will-quit', function(event) {
console.log('will-quit');
_this.addonManager.deactivateAll(app);
- _this.killAllProcesses();
});
app.on('quit', function(event) {
console.log('quit');
});
wrt.on('suspend', function() {
console.log('suspend');
- _this.webApplication.suspend(_this.addonManager.suspend_path);
+ if (_this.webApplication)
+ _this.webApplication.suspend(_this.addonManager.suspend_path);
});
wrt.on('resume', function() {
console.log('resume');
_this.webApplication.resume(_this.addonManager.resume_path);
});
- wrt.on('terminate', function() {
- console.log('terminate');
- _this.webApplication.terminate();
- });
}
- onLanguageChanged() {}
- onLowMemory() {}
- killAllProcesses() {}
handleIpcMessages() {
var _this = this;
ipcMain.on(IPC_MESSAGE.ADDONS.INSTALLED, (sender, name) => {
}
this.accessiblePath = wrt.getAccessiblePath();
this.isAlwaysReload = wrt.isAlwaysReload();
- this.isTerminating = false;
this.suspended = true;
this.loadFinished = false;
this.runningStatus = 'none';
console.log(`window closed : #${self.windowList.length}`);
let index = self.windowList.indexOf(window);
self.windowList.splice(index, 1);
- if (!self.isTerminating && index === self.windowList.length && self.windowList.length > 0)
+ if (index === self.windowList.length && self.windowList.length > 0)
self.windowList[self.windowList.length - 1].show();
});
});
}
}
this.suspended = true;
- if (this.isTerminating) {
- console.log('App has been terminated; return');
- return;
- }
- let windows = WRTWindow.getAllWindows();
if (this.isTVProfile) {
wrt.flushCookie();
this.windowList.forEach((window) => window.webContents.session.flushStorageData());
app.quit();
}, 1000);
} else if (!this.backgroundSupport) {
- windows.forEach((window) => window.setEnabled(false));
+ this.windowList.forEach((window) => window.setEnabled(false));
}
this.windowList[this.windowList.length - 1].hide();
}
}
return;
}
- WRTWindow.getAllWindows().forEach((window) => {
- if (!this.backgroundSupport)
- window.setEnabled(true);
- });
+ if (!this.backgroundSupport) {
+ this.windowList.forEach((window) => window.setEnabled(true));
+ }
this.windowList[this.windowList.length - 1].show();
}
- terminate() {
- this.isTerminating = true;
+ finalize() {
+ this.windowList.forEach((window) => {
+ window.removeAllListeners();
+ });
}
quit(path) {
console.log('WebApplication : quit');
}
}
closeWindows() {
- WRTWindow.getAllWindows().forEach((window) => {
+ this.windowList.forEach((window) => {
if (window != this.mainWindow)
window.destroy();
});