Skip to content
Snippets Groups Projects
Commit 32423169 authored by Jeremy Kersten's avatar Jeremy Kersten
Browse files

[FIX] web: namespace the event for Apps Widget.

With the new client web from v9, we start the new action before to destroy the old one.

When we switch from Apps (store) to Update and vice-versa, iframe was not loaded correctly.

In case of the Apps widget, we are binding event of the new iframe during the start,
and when it is ready, we destroy the old ifram and so unbind the listener of 'message.apps'.

Using a uniq id, we ensure to bind new event, and only unbind old event during the destroy.
parent 2b2be3ca
Branches
Tags
No related merge requests found
......@@ -62,7 +62,7 @@ var Apps = Widget.extend({
},
destroy: function() {
$(window).off("message.apps");
$(window).off("message." + this.uniq);
if (this.$ifr) {
this.$ifr.remove();
this.$ifr = null;
......@@ -114,10 +114,12 @@ var Apps = Widget.extend({
var qs = (session.debug ? 'debug&' : '') + 'db=' + client.dbname;
var u = client.origin + '/apps/embed/client?' + qs;
var css = {width: '100%', height: '400px'};
var css = {width: '100%', height: '750px'};
self.$ifr = $('<iframe>').attr('src', u);
$(window).on("message.apps", self.proxy('_on_message'));
self.uniq = _.uniqueId('apps');
$(window).on("message." + self.uniq, self.proxy('_on_message'));
self.on('message:ready', self, function(m) {
var w = this.$ifr[0].contentWindow;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment