Commit bc1e0279 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_jabber_client] Defer the page refresh

Wait a bit before triggering a refresh to prevent multiple refresh when many notifications occur
parent b34042dd
......@@ -259,7 +259,7 @@
return gadget.state_parameter_dict.volatile_jio.put(from, doc);
})
.push(function () {
return gadget.refresh();
return gadget.deferRefresh();
});
})
......@@ -282,7 +282,7 @@
return gadget.state_parameter_dict.volatile_jio.put(argument_list[0], doc);
})
.push(function () {
return gadget.refresh();
return gadget.deferRefresh();
});
})
......@@ -383,6 +383,18 @@
.declareAcquiredMethod('redirect', 'redirect')
.declareAcquiredMethod('getUrlFor', 'getUrlFor')
.declareAcquiredMethod('refresh', 'refresh')
.declareJob('deferRefresh', function () {
var gadget = this;
return new RSVP.Queue()
.push(function () {
// Wait a bit before triggering a refresh
// to prevent multiple refresh when many notifications occur
return RSVP.delay(200);
})
.push(function () {
return gadget.refresh();
});
})
.declareMethod('createJio', function () {
return this.state_parameter_dict.persistent_jio.createJio({
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>963.13623.60350.63692</string> </value>
<value> <string>963.13624.8061.44390</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1509724327.32</float>
<float>1510064649.5</float>
<string>UTC</string>
</tuple>
</state>
......
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