You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
121 KiB
Plaintext
1 line
121 KiB
Plaintext
12 months ago
|
{"version":3,"sources":["config/versionTemplate.txt","lib/rsvp/events.js","lib/rsvp/config.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.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 4.8.4+ff10049b\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 EventTarget\n @for rsvp\n @public\n*/\nexport default {\n\n /**\n `EventTarget.mixin` extends an object with EventTarget methods. For\n Example:\n ```javascript\n import EventTarget from 'rsvp';\n let object = {};\n 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 import EventTarget from 'rsvp';\n let Person = function() {};\n 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\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 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 var callbacks = allCallbacks[eventName];\n\n if (!callbacks) {\n callbacks = allCallbacks[eventName] = [];\n }\n\n if (callbacks.indexOf(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('stuff', callback2);\n object.trigger('stuff'); // callback1 and callback2 will be executed.\n object.off('stuff');\n object.trigger('stuff'); // callback1 and callback2 will not be executed
|