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/promise/tracer.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/promise/tracer.js.uncompressed.js')
-rw-r--r-- | lib/dojo/promise/tracer.js.uncompressed.js | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/dojo/promise/tracer.js.uncompressed.js b/lib/dojo/promise/tracer.js.uncompressed.js deleted file mode 100644 index b5380cc32..000000000 --- a/lib/dojo/promise/tracer.js.uncompressed.js +++ /dev/null @@ -1,85 +0,0 @@ -define("dojo/promise/tracer", [ - "../_base/lang", - "./Promise", - "../Evented" -], function(lang, Promise, Evented){ - "use strict"; - - // module: - // dojo/promise/tracer - - /*===== - return { - // summary: - // Trace promise fulfillment. - // description: - // Trace promise fulfillment. Calling `.trace()` or `.traceError()` on a - // promise enables tracing. Will emit `resolved`, `rejected` or `progress` - // events. - - on: function(type, listener){ - // summary: - // Subscribe to traces. - // description: - // See `dojo/Evented#on()`. - // type: String - // `resolved`, `rejected`, or `progress` - // listener: Function - // The listener is passed the traced value and any arguments - // that were used with the `.trace()` call. - } - }; - =====*/ - - var evented = new Evented; - var emit = evented.emit; - evented.emit = null; - // Emit events asynchronously since they should not change the promise state. - function emitAsync(args){ - setTimeout(function(){ - emit.apply(evented, args); - }, 0); - } - - Promise.prototype.trace = function(){ - // summary: - // Trace the promise. - // description: - // Tracing allows you to transparently log progress, - // resolution and rejection of promises, without affecting the - // promise itself. Any arguments passed to `trace()` are - // emitted in trace events. See `dojo/promise/tracer` on how - // to handle traces. - // returns: dojo/promise/Promise - // The promise instance `trace()` is called on. - - var args = lang._toArray(arguments); - this.then( - function(value){ emitAsync(["resolved", value].concat(args)); }, - function(error){ emitAsync(["rejected", error].concat(args)); }, - function(update){ emitAsync(["progress", update].concat(args)); } - ); - return this; - }; - - Promise.prototype.traceRejected = function(){ - // summary: - // Trace rejection of the promise. - // description: - // Tracing allows you to transparently log progress, - // resolution and rejection of promises, without affecting the - // promise itself. Any arguments passed to `trace()` are - // emitted in trace events. See `dojo/promise/tracer` on how - // to handle traces. - // returns: dojo/promise/Promise - // The promise instance `traceRejected()` is called on. - - var args = lang._toArray(arguments); - this.otherwise(function(error){ - emitAsync(["rejected", error].concat(args)); - }); - return this; - }; - - return evented; -}); |