From 04cf441c5ae18400c6b4865b0b37a71718dc9d46 Mon Sep 17 00:00:00 2001 From: Ola Bini Date: Thu, 31 Jul 2014 19:29:33 -0300 Subject: Add web-ui based on previous code --- web-ui/app/js/mail_list/domain/refresher.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 web-ui/app/js/mail_list/domain/refresher.js (limited to 'web-ui/app/js/mail_list/domain') diff --git a/web-ui/app/js/mail_list/domain/refresher.js b/web-ui/app/js/mail_list/domain/refresher.js new file mode 100644 index 00000000..f1fe504d --- /dev/null +++ b/web-ui/app/js/mail_list/domain/refresher.js @@ -0,0 +1,25 @@ +define(['flight/lib/component', 'page/events'], function(defineComponent, events) { + 'use strict'; + + return defineComponent(refresher); + + function refresher() { + this.defaultAttrs({ + interval: 20000 + }); + + this.setupRefresher = function() { + setTimeout(this.doRefresh.bind(this), this.attr.interval); + }; + + this.doRefresh = function() { + this.trigger(document, events.ui.mails.refresh); + this.setupRefresher(); + }; + + this.after('initialize', function () { + this.setupRefresher(); + }); + } + } +); -- cgit v1.2.3