Commit e9cf32fe authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Router: use a job to start listening to the hash change

parent 4a2e0583
...@@ -753,8 +753,7 @@ ...@@ -753,8 +753,7 @@
rJS(window) rJS(window)
.ready(function (gadget) { .ready(function (gadget) {
gadget.props = { gadget.props = {
options: {}, options: {}
start_deferred: RSVP.defer()
}; };
}) })
...@@ -891,9 +890,7 @@ ...@@ -891,9 +890,7 @@
} }
}); });
} }
}) return gadget.listenHashChange();
.push(function () {
gadget.props.start_deferred.resolve();
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
if (error instanceof RSVP.CancellationError) { if (error instanceof RSVP.CancellationError) {
...@@ -910,15 +907,8 @@ ...@@ -910,15 +907,8 @@
.declareAcquiredMethod('getSetting', 'getSetting') .declareAcquiredMethod('getSetting', 'getSetting')
.declareAcquiredMethod('renderError', 'reportServiceError') .declareAcquiredMethod('renderError', 'reportServiceError')
.declareService(function () { .declareJob('listenHashChange', function () {
var gadget = this; return listenHashChange(this);
return new RSVP.Queue()
.push(function () {
return gadget.props.start_deferred.promise;
})
.push(function () {
return listenHashChange(gadget);
});
}); });
}(window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob)); }(window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment