Skip to content

Instantly share code, notes, and snippets.

@rexboy7
Created Feb 12, 2015
Embed
What would you like to do?
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