diff options
author | Barak Korren <[email protected]> | 2013-04-02 20:38:07 +0300 |
---|---|---|
committer | Barak Korren <[email protected]> | 2013-04-02 20:38:07 +0300 |
commit | 58a2577d48790c79adfd44bcfd662c980ce6cfe4 (patch) | |
tree | 523d814ea0b7b6f617fe515b186099c6e83fed72 /lib/dojo/request/notify.js.uncompressed.js | |
parent | e470a273cf09562fb2f9c0c899002303f19c8d16 (diff) | |
parent | cc332603431102a682feda22b9cf0093a29f0176 (diff) |
Merge branch 'master' of https://github.com/gothfox/Tiny-Tiny-RSS.git
Diffstat (limited to 'lib/dojo/request/notify.js.uncompressed.js')
-rw-r--r-- | lib/dojo/request/notify.js.uncompressed.js | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/lib/dojo/request/notify.js.uncompressed.js b/lib/dojo/request/notify.js.uncompressed.js deleted file mode 100644 index 2b8a2b68b..000000000 --- a/lib/dojo/request/notify.js.uncompressed.js +++ /dev/null @@ -1,74 +0,0 @@ -define("dojo/request/notify", ['../Evented', '../_base/lang', './util'], function(Evented, lang, util){ - // module: - // dojo/request/notify - // summary: - // Global notification API for dojo/request. Notifications will - // only be emitted if this module is required. - // - // | require('dojo/request', 'dojo/request/notify', - // | function(request, notify){ - // | notify('load', function(response){ - // | if(response.url === 'someUrl.html'){ - // | console.log('Loaded!'); - // | } - // | }); - // | request.get('someUrl.html'); - // | } - // | ); - - var pubCount = 0, - slice = [].slice; - - var hub = lang.mixin(new Evented, { - onsend: function(data){ - if(!pubCount){ - this.emit('start'); - } - pubCount++; - }, - _onload: function(data){ - this.emit('done', data); - }, - _onerror: function(data){ - this.emit('done', data); - }, - _ondone: function(data){ - if(--pubCount <= 0){ - pubCount = 0; - this.emit('stop'); - } - }, - emit: function(type, event){ - var result = Evented.prototype.emit.apply(this, arguments); - - // After all event handlers have run, run _on* handler - if(this['_on' + type]){ - this['_on' + type].apply(this, slice.call(arguments, 1)); - } - return result; - } - }); - - function notify(type, listener){ - // summary: - // Register a listener to be notified when an event - // in dojo/request happens. - // type: String? - // The event to listen for. Events emitted: "start", "send", - // "load", "error", "done", "stop". - // listener: Function? - // A callback to be run when an event happens. - // returns: - // A signal object that can be used to cancel the listener. - // If remove() is called on this signal object, it will - // stop the listener from being executed. - return hub.on(type, listener); - } - notify.emit = function(type, event, cancel){ - return hub.emit(type, event, cancel); - }; - - // Attach notify to dojo/request/util to avoid - // try{ require('./notify'); }catch(e){} - return util.notify = notify; -}); |