-
-
Save rexboy7/d09c345857cf219ea4e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tv_apps/smart-system/js/app_window.js b/tv_apps/smart-system/js/app_window.js | |
index d7f6812..6f8b4fc 100644 | |
--- a/tv_apps/smart-system/js/app_window.js | |
+++ b/tv_apps/smart-system/js/app_window.js | |
@@ -422,6 +422,7 @@ | |
clearTimeout(fallbackTimeout); | |
this.element.removeEventListener('_closed', onClosed); | |
this.destroy(); | |
+ this.publish('terminated'); | |
}.bind(this); | |
this.element.addEventListener('_closed', onClosed); | |
@@ -436,13 +437,12 @@ | |
} | |
} else { | |
this.destroy(); | |
+ /** | |
+ * Fired when the instance is terminated. | |
+ * @event AppWindow#appterminated | |
+ */ | |
+ this.publish('terminated'); | |
} | |
- | |
- /** | |
- * Fired when the instance is terminated. | |
- * @event AppWindow#appterminated | |
- */ | |
- this.publish('terminated'); | |
}; | |
/** | |
diff --git a/tv_apps/smart-system/js/app_window_factory.js b/tv_apps/smart-system/js/app_window_factory.js | |
index 68279d0..dbbddc7 100644 | |
--- a/tv_apps/smart-system/js/app_window_factory.js | |
+++ b/tv_apps/smart-system/js/app_window_factory.js | |
@@ -138,15 +138,15 @@ | |
if (app) { | |
// If target app existed, kill it and relaunch. | |
- app.kill(); | |
- window.addEventListener('appdestroyed', | |
+ window.addEventListener('appterminated', | |
function awf_onappdestroyed(evt) { | |
- if (evt.detail.instanceID !== app.instanceID) { | |
+ if (evt.detail.manifestURL !== app.manifestURL) { | |
return; | |
} | |
- window.removeEventListener('appdestroyed', awf_onappdestroyed); | |
+ window.removeEventListener('appterminated', awf_onappdestroyed); | |
self._launchPresentationApp(config, protocol); | |
}); | |
+ app.kill(); | |
} else { | |
self._launchPresentationApp(config, protocol); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment