}
}
+ private needSuspend() {
+ return this.launchMode !== 'runningAsBackground' &&
+ (this.preloadStatus === 'preload' || this.runningStatus === 'behind');
+ }
+
private suspendByStatus() {
- if (this.launchMode == 'runningAsBackground') {
- console.log('WebApplication : runningAsBackground suspend is skipped!');
- return;
- }
- if (this.preloadStatus === 'preload' ||
- this.runningStatus === 'behind') {
+ if (this.needSuspend()) {
console.log('WebApplication : suspendByStatus');
console.log(`preloadStatus: ${this.preloadStatus}, runningStatus: ${this.runningStatus}`);
- // TODO : Need to care this situation and decide to pass the addon event emitter to suspend()
+
this.webApplication.suspend();
if (this.preloadStatus === 'preload')
this.runningStatus = 'preload';
}
}
- private handlePreloadState(launchMode: string) {
- if (this.preloadStatus === 'preload' || launchMode != 'backgroundAtStartup')
- this.preloadStatus = 'none';
- }
-
backgroundExecutable() {
return this.backgroundExecution;
}
isPreloading() {
- if (this.preloadStatus == 'preload' || this.launchMode == 'runningAsBackground') {
+ if (this.preloadStatus === 'preload' ||
+ this.launchMode === 'runningAsBackground') {
console.log(`preloadStatus is ${this.preloadStatus} or ${this.launchMode}, show is skipped`);
return true;
}
}
canIgnoreSuspend() {
- if (this.launchMode == 'runningAsForeground' ||
- this.launchMode == 'runningAsBackground') {
+ if (this.launchMode === 'runningAsForeground' ||
+ this.launchMode === 'runningAsBackground') {
console.log('WebApplication : view_suspend & multitasking feature is skipped!');
return true;
}
handleAppControlEvent(appControl: any) {
this.launchMode = appControl.getData('http://samsung.com/appcontrol/data/launch_mode');
- this.handlePreloadState(this.launchMode);
+ this.preloadStatus = 'none';
if (this.launchMode === 'runningAsBackground') {
this.webApplication.suspended = false;
this.webApplication.resume();
this.webApplication.sendAppControlEvent();
return false;
- }
-
- let skipReload = appControl.getData('SkipReload');
- if (skipReload == 'Yes') {
- console.log('skipping reload');
- // TODO : Need to care this situation and decide to pass the addon event emitter to resume()
- this.webApplication.resume();
- return false;
+ } else {
+ let skipReload = appControl.getData('SkipReload');
+ if (skipReload == 'Yes') {
+ console.log('skipping reload');
+ // TODO : Need to care this situation and decide to pass the addon event emitter to resume()
+ this.webApplication.resume();
+ return false;
+ }
}
return true;
}