preloadStatus: string = 'none';
runningStatus: string = 'none';
launchMode: string = 'none';
+ needDispatchTizenVisibilityChange: boolean = false;
tv: any = (wrt.tv as NativeWRTjs.TVExtension);
constructor(webApplication: WebApplication) {
console.log(`runningStatus is DialogClose, src is ${this.inspectorSrc}`);
this.webApplication.mainWindow.loadURL(this.inspectorSrc);
this.inspectorSrc = '';
+ this.needDispatchTizenVisibilityChange = true;
} else if (this.runningStatus == 'behind' && this.webApplication.loadFinished) {
// TODO : Need to care this situation and decide to pass the addon event emitter to suspend()
this.webApplication.suspend();
this.showInspectorGuide();
else
this.suspendByStatus();
+
+ if (this.needDispatchTizenVisibilityChange)
+ this.sendTizenVisibilityEvent(this.webApplication.mainWindow.isVisible());
+ }
+
+ private sendTizenVisibilityEvent = (visibility: boolean) => {
+ console.log(`sendTizenVisibilityEvent call`);
+ this.needDispatchTizenVisibilityChange = false;
+ const kTizenvisibilityEventScript = `(function(){
+var __event = document.createEvent("CustomEvent");
+__event.initCustomEvent('tizenvisibilitychange', true, true, {visible: ${visibility} | 0});
+document.dispatchEvent(__event);
+for (var i=0; i < window.frames.length; i++)
+ window.frames[i].document.dispatchEvent(__event);
+})()`;
+ let webContents = this.webApplication.mainWindow.webContents;
+ wrt.executeJS(webContents, kTizenvisibilityEventScript);
}
private showInspectorGuide() {