import { WebApplication } from './web_application';
class Runtime {
+ skipCreateTizenWebAppOnce: Boolean = false;
webApplication?: WebApplication = undefined;
constructor() {
this.handleAppControlForElectronApp(appControl);
return;
}
+ if (this.skipCreateTizenWebAppOnce) {
+ this.skipCreateTizenWebAppOnce = false;
+ console.log('Already WebApplication instance created');
+ this.webApplication?.loadUrl(appControl);
+ return;
+ }
console.log('Tizen Web App launch');
if (!this.webApplication) {
this.createWebApplicationAndLoadUrl(appControl);
this.webApplication?.hideSplashScreen(params[0]);
} else if (type === 'selectionText') {
addonManager.emit('message', type, params[0]);
+ } else if (type === 'loadHostedApp') {
+ const url = params[0];
+ const needInspector = wrt.tv?.needUseInspector();
+ console.log(`url : ${url}, needInspector : ${needInspector}`);
+ if (needInspector)
+ return;
+
+ if (!this.webApplication) {
+ let options: RuntimeOption = {
+ isAddonAvailable: false,
+ launchMode: ''
+ }
+ this.webApplication = new WebApplication(options);
+ this.skipCreateTizenWebAppOnce = true;
+ }
+ this.webApplication.loadUrlEarly(url);
}
});
profileDelegate: WebApplicationDelegate;
splashShown: boolean = false;
reload: boolean = false;
+ earlyLoadedUrl: string = '';
constructor(options: RuntimeOption) {
if (wrt.tv) {
}
}
+ loadUrlEarly(url: string) {
+ console.log(`early load : ${url}`);
+ this.earlyLoadedUrl = url;
+ this.mainWindow.loadURL(url);
+ }
+
loadUrl(appControl: NativeWRTjs.AppControl) {
this.contentSrc = appControl.getLoadInfo().getSrc();
+ if (this.earlyLoadedUrl === this.contentSrc)
+ return;
+
this.launchInspectorIfNeeded(appControl);
this.mainWindow.loadURL(this.contentSrc);
this.prelaunch(this.contentSrc);