isAlwaysReload: boolean = false;
initBundleValue: string = 'none';
preloadStatus: string = 'none';
+ isPreloadReady: boolean = true;
runningStatus: string = 'none';
launchMode: string = 'none';
needDispatchTizenVisibilityChange: boolean = false;
console.log(`launch mode is ${this.launchMode}`);
if (options.launchMode === 'backgroundAtStartup') {
this.preloadStatus = 'preload';
+ this.isPreloadReady = false;
} else {
this.preloadStatus = 'none';
}
this.webApplication.sendAppControlEvent();
return false;
} else if ((this.launchMode === 'runningAsForeground') || (resumeWithAppControl === 'Yes')) {
- this.webApplication.resume();
+ this.webApplication.show();
this.webApplication.sendAppControlEvent();
return false;
} else {
focus(webContents: any) {
this.tv.focus(webContents);
}
+
+ preloadReady() {
+ if (this.isPreloadReady)
+ return true;
+
+ if (!this.webApplication.readyToShow)
+ return false;
+
+ this.isPreloadReady = true;
+ return true;
+ }
}
splashShown: boolean = false;
reload: boolean = false;
earlyLoadedUrl: string = '';
+ readyToShow: boolean = false;
constructor(options: RuntimeOption) {
if (wrt.tv) {
return;
console.log('mainWindow ready-to-show');
+ this.readyToShow = true;
if (this.showTimer)
clearTimeout(this.showTimer);
}
sendAppControlEvent() {
+ console.log('webApplication : sendAppControlEvent');
const kAppControlEventScript = `(function(){
var __event = document.createEvent("CustomEvent");
__event.initCustomEvent("appcontrol", true, true, null);
}
show() {
+ if (!this.profileDelegate.preloadReady()) {
+ console.log('preload is not ready');
+ return;
+ }
+
if (this.profileDelegate.isBackgroundLaunch()) {
console.log('show() will be skipped by background launch');
return;