From: YONGMAN SON Date: Mon, 25 Mar 2019 07:49:21 +0000 (+0900) Subject: [VD feature] add preloading feature X-Git-Tag: submit/tizen/20190329.010456~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a0735f282d5a480a0e46033c32097d9102df5c7c;p=platform%2Fframework%2Fweb%2Fwrtjs.git [VD feature] add preloading feature http://wiki.vd.sec.samsung.net/x/Kr5iAw WRTJS TCs -> 1.5 Change-Id: I929356b3f196c6476d4ee9199b1f80fb5e8729a8 --- diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js index acc25c0a..8017068a 100755 --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -82,6 +82,15 @@ class Runtime { let src = loadInfo.getSrc(); if (_this.webApplication) { + if (_this.webApplication.preloadState == 'readyToShow') { + _this.webApplication.show(); + } + + let launchMode = appControl.getData('http://samsung.com/appcontrol/data/launch_mode'); + if (launchMode != 'backgroundAtStartup') { + _this.webApplication.preloadState = 'none'; + } + let skipReload = appControl.getData('SkipReload'); if (skipReload == 'Yes') { console.log('skipping reload'); @@ -121,6 +130,11 @@ class Runtime { app.emit('ready'); } else { _this.webApplication = new WebApplication(options); + let launchMode = appControl.getData('http://samsung.com/appcontrol/data/launch_mode'); + if (launchMode == 'backgroundAtStartup') { + console.log('backgroundAtStartup'); + _this.webApplication.preloadState = "preload"; + } _this.webApplication.mainWindow.loadURL(src); } // FIX ME : It must be supplemented to set a specific path diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js index db8c768e..ade5d7d2 100755 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -32,7 +32,7 @@ class WebApplication { } console.log('mainWindow id : ' + this.mainWindow.id); this.handleEvents(winopt); - this.firstRendered = false; + this.preloadState = 'none'; this.backgroundSupport = wrt.getBackgroundSupport(); this.multitaskingSupport = wrt.getMultitaskingSupport(); } @@ -56,12 +56,12 @@ class WebApplication { this.mainWindow.on('ready-to-show', function() { console.log('mainWindow ready-to-show'); wrt.hideSplashScreen(1); - self.firstRendered = true; - - if (!self.mainWindow.isVisible()) { - console.log('show browserWindow'); - self.mainWindow.show(); + if (self.preloadState == 'preload') { + self.preloadState = 'readyToShow'; + console.log('preloading show is skipped!'); + return; } + self.show(); }); this.mainWindow.on('closed', function() { console.log('mainWindow closed!'); @@ -111,5 +111,12 @@ class WebApplication { '})()'; wrt.executeJS(this.mainWindow.webContents, kAppControlEventScript); } + show() { + this.preloadState = 'none'; + if (!this.mainWindow.isVisible()) { + console.log('show browserWindow'); + this.mainWindow.show(); + } + } } module.exports = WebApplication;