1 line
110 KiB
Plaintext
1 line
110 KiB
Plaintext
|
{"version":3,"sources":["config/versionTemplate.txt","lib/rsvp/events.js","lib/rsvp/config.js","lib/rsvp/utils.js","lib/rsvp/instrument.js","lib/rsvp/promise/resolve.js","lib/rsvp/-internal.js","lib/rsvp/then.js","lib/rsvp/enumerator.js","lib/rsvp/promise/all.js","lib/rsvp/promise/race.js","lib/rsvp/promise/reject.js","lib/rsvp/promise.js","lib/rsvp/node.js","lib/rsvp/all.js","lib/rsvp/all-settled.js","lib/rsvp/race.js","lib/rsvp/promise-hash.js","lib/rsvp/hash.js","lib/rsvp/hash-settled.js","lib/rsvp/rethrow.js","lib/rsvp/defer.js","lib/rsvp/map.js","lib/rsvp/resolve.js","lib/rsvp/reject.js","lib/rsvp/filter.js","lib/rsvp/asap.js","lib/rsvp/platform.js","lib/rsvp.js"],"sourcesContent":["/*!\n * @overview RSVP - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2016 Yehuda Katz, Tom Dale, Stefan Penner and contributors\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/tildeio/rsvp.js/master/LICENSE\n * @version 3.6.2\n */\n","function indexOf(callbacks, callback) {\n for (var i = 0, l = callbacks.length; i < l; i++) {\n if (callbacks[i] === callback) {\n return i;\n }\n }\n\n return -1;\n}\n\nfunction callbacksFor(object) {\n var callbacks = object._promiseCallbacks;\n\n if (!callbacks) {\n callbacks = object._promiseCallbacks = {};\n }\n\n return callbacks;\n}\n\n/**\n @class RSVP.EventTarget\n*/\nexport default {\n\n /**\n `RSVP.EventTarget.mixin` extends an object with EventTarget methods. For\n Example:\n ```javascript\n let object = {};\n RSVP.EventTarget.mixin(object);\n object.on('finished', function(event) {\n // handle event\n });\n object.trigger('finished', { detail: value });\n ```\n `EventTarget.mixin` also works with prototypes:\n ```javascript\n let Person = function() {};\n RSVP.EventTarget.mixin(Person.prototype);\n let yehuda = new Person();\n let tom = new Person();\n yehuda.on('poke', function(event) {\n console.log('Yehuda says OW');\n });\n tom.on('poke', function(event) {\n console.log('Tom says OW');\n });\n yehuda.trigger('poke');\n tom.trigger('poke');\n ```\n @method mixin\n @for RSVP.EventTarget\n @private\n @param {Object} object object to extend with EventTarget methods\n */\n mixin: function (object) {\n object['on'] = this['on'];\n object['off'] = this['off'];\n object['trigger'] = this['trigger'];\n object._promiseCallbacks = undefined;\n return object;\n },\n\n\n /**\n Registers a callback to be executed when `eventName` is triggered\n ```javascript\n object.on('event', function(eventInfo){\n // handle the event\n });\n object.trigger('event');\n ```\n @method on\n @for RSVP.EventTarget\n @private\n @param {String} eventName name of the event to listen for\n @param {Function} callback function to be called when the event is triggered.\n */\n on: function (eventName, callback) {\n if (typeof callback !== 'function') {\n throw new TypeError('Callback must be a function');\n }\n\n var allCallbacks = callbacksFor(this),\n callbacks = void 0;\n\n callbacks = allCallbacks[eventName];\n\n if (!callbacks) {\n callbacks = allCallbacks[eventName] = [];\n }\n\n if (indexOf(callbacks, callback) === -1) {\n callbacks.push(callback);\n }\n },\n\n\n /**\n You can use `off` to stop firing a particular callback for an event:\n ```javascript\n function doStuff() { // do stuff! }\n object.on('stuff', doStuff);\n object.trigger('stuff'); // doStuff will be called\n // Unregister ONLY the doStuff callback\n object.off('stuff', doStuff);\n object.trigger('stuff'); // doStuff will NOT be called\n ```\n If you don't pass a `callback` argument to `off`, ALL callbacks for the\n event will not be executed when the event fires. For example:\n ```javascript\n let callback1 = function(){};\n let callback2 = function(){};\n object.on('stuff', callback1);\n object.on('s
|