}
private handlePreloadState(launchMode: string) {
- if (this.preloadStatus === 'preload') {
- this.show();
- } else {
- if (launchMode != 'backgroundAtStartup')
- this.preloadStatus = 'none';
- }
+ if (this.preloadStatus === 'preload' || launchMode != 'backgroundAtStartup')
+ this.preloadStatus = 'none';
}
backgroundExecutable() {
return false;
}
- show() {
- this.preloadStatus = 'none';
- }
-
canIgnoreSuspend() {
if (this.launchMode == 'runningAsForeground' ||
this.launchMode == 'runningAsBackground') {
windowList: Electron.BrowserWindow[] = [];
inQuit: boolean = false;
profileDelegate: WebApplicationDelegate;
+ splashShown: boolean = false;
constructor(options: RuntimeOption) {
if (wrt.tv) {
};
}
+ hideSplashScreen(reason: string) {
+ switch (reason) {
+ case 'first-paint': {
+ if (wrt.hideSplashScreen(0) !== false)
+ this.show();
+ break;
+ }
+ case 'complete': {
+ if (wrt.hideSplashScreen(1) !== false)
+ this.show();
+ break;
+ }
+ case 'custom': {
+ if (wrt.hideSplashScreen(2) !== false)
+ this.show();
+ break;
+ }
+ case 'video-finished': {
+ this.show();
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
private setupMainWindowEventListener() {
this.mainWindow.once('ready-to-show', () => {
console.log('mainWindow ready-to-show');
if (this.showTimer)
clearTimeout(this.showTimer);
- wrt.hideSplashScreen(0);
- if (this.profileDelegate.isPreloading())
- return;
- this.show();
+
+ if (this.splashShown)
+ this.hideSplashScreen('first-paint');
+ else
+ this.show();
});
this.mainWindow.webContents.on('did-start-loading', () => {
this.mainWindow.webContents.on('did-finish-load', () => {
console.log('webContents did-finish-load');
this.loadFinished = true;
- wrt.hideSplashScreen(1);
+ if (this.splashShown)
+ this.hideSplashScreen('complete');
+
addonManager.emit('contentDidFinishLoad', this.mainWindow.id);
if (wrt.isIMEWebApp()) {
this.activateIMEWebHelperClient();
if (this.profileDelegate.isPreloading())
return;
- let splashShown = wrt.showSplashScreen();
- if (splashShown || !this.profileDelegate.needShowTimer())
+ this.splashShown = wrt.showSplashScreen();
+ if (this.splashShown || !this.profileDelegate.needShowTimer())
return;
this.showTimer = setTimeout(() => {
}
show() {
+ if (this.profileDelegate.isPreloading()) {
+ return;
+ }
console.log('WebApplication : show');
if (this.profileDelegate.backgroundExecutable()) {
console.log('skip showing while backgroundExecution mode');
this.windowList[this.windowList.length - 1].moveTop();
}
}
- this.profileDelegate.show();
}
private closeWindows() {