Commit 893e6ce9 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_xhtml_style/erp5_web_renderjs_ui] Update to latest published rsvp

parent f9c408f7
(function(globals) { (function(globals) {
var define, requireModule; var define, requireModule;
(function() { (function() {
var registry = {}, seen = {}; var registry = {}, seen = {};
define = function(name, deps, callback) { define = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback }; registry[name] = { deps: deps, callback: callback };
}; };
requireModule = function(name) { requireModule = function(name) {
if (seen[name]) { return seen[name]; } if (seen[name]) { return seen[name]; }
seen[name] = {}; seen[name] = {};
var mod = registry[name]; var mod = registry[name];
if (!mod) { if (!mod) {
throw new Error("Module '" + name + "' not found."); throw new Error("Module '" + name + "' not found.");
} }
var deps = mod.deps, var deps = mod.deps,
callback = mod.callback, callback = mod.callback,
reified = [], reified = [],
exports; exports;
for (var i=0, l=deps.length; i<l; i++) { for (var i=0, l=deps.length; i<l; i++) {
if (deps[i] === 'exports') { if (deps[i] === 'exports') {
reified.push(exports = {}); reified.push(exports = {});
} else { } else {
reified.push(requireModule(deps[i])); reified.push(requireModule(deps[i]));
} }
} }
var value = callback.apply(this, reified); var value = callback.apply(this, reified);
return seen[name] = exports || value; return seen[name] = exports || value;
}; };
})(); })();
define("rsvp/all", define("rsvp/all",
["rsvp/promise","exports"], ["rsvp/promise","exports"],
function(__dependency1__, __exports__) { function(__dependency1__, __exports__) {
"use strict"; "use strict";
var Promise = __dependency1__.Promise; var Promise = __dependency1__.Promise;
/* global toString */ /* global toString */
function promiseAtLeast(expected_count, promises) { function promiseAtLeast(expected_count, promises) {
if (Object.prototype.toString.call(promises) !== "[object Array]") { if (Object.prototype.toString.call(promises) !== "[object Array]") {
throw new TypeError('You must pass an array to all.'); throw new TypeError('You must pass an array to all.');
} }
function canceller() { function canceller() {
var promise; var promise;
for (var i = 0; i < promises.length; i++) { for (var i = 0; i < promises.length; i++) {
promise = promises[i]; promise = promises[i];
if (promise && typeof promise.then === 'function' && if (promise && typeof promise.then === 'function' &&
typeof promise.cancel === 'function') { typeof promise.cancel === 'function') {
promise.cancel(); promise.cancel();
} }
} }
} }
return new Promise(function(resolve, reject, notify) { return new Promise(function(resolve, reject) {
var results = [], remaining = promises.length, var results = [], remaining = promises.length,
promise, remaining_count = promises.length - expected_count; promise, remaining_count = promises.length - expected_count;
if (remaining === 0) { if (remaining === 0) {
if (expected_count === 1) { if (expected_count === 1) {
resolve(); resolve();
} else { } else {
resolve([]); resolve([]);
} }
} }
function resolver(index) { function resolver(index) {
return function(value) { return function(value) {
resolveAll(index, value); resolveAll(index, value);
}; };
} }
function resolveAll(index, value) { function resolveAll(index, value) {
results[index] = value; results[index] = value;
if (--remaining === remaining_count) { if (--remaining === remaining_count) {
if (remaining_count === 0) { if (remaining_count === 0) {
resolve(results); resolve(results);
} else { } else {
resolve(value); resolve(value);
canceller(); canceller();
} }
} }
} }
function notifier(index) { function cancelAll(rejectionValue) {
return function(value) { reject(rejectionValue);
notify({"index": index, "value": value}); canceller();
}; }
}
for (var i = 0; i < promises.length; i++) {
function cancelAll(rejectionValue) { promise = promises[i];
reject(rejectionValue);
canceller(); if (promise && typeof promise.then === 'function') {
} promise.then(resolver(i), cancelAll);
} else {
for (var i = 0; i < promises.length; i++) { resolveAll(i, promise);
promise = promises[i]; }
}
if (promise && typeof promise.then === 'function') { }, canceller
promise.then(resolver(i), cancelAll, notifier(i)); );
} else { }
resolveAll(i, promise);
} function all(promises) {
} return promiseAtLeast(promises.length, promises);
}, canceller }
);
} function any(promises) {
return promiseAtLeast(1, promises);
function all(promises) { }
return promiseAtLeast(promises.length, promises);
}
__exports__.all = all;
function any(promises) { __exports__.any = any;
return promiseAtLeast(1, promises); });
} define("rsvp/async",
["exports"],
function(__exports__) {
__exports__.all = all; "use strict";
__exports__.any = any; var browserGlobal = (typeof window !== 'undefined') ? window : {};
}); var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
define("rsvp/async", var async;
["exports"], var local = (typeof global !== 'undefined') ? global : this;
function(__exports__) {
"use strict"; function checkNativePromise() {
var browserGlobal = (typeof window !== 'undefined') ? window : {}; if (typeof Promise === "function" &&
var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; typeof Promise.resolve === "function") {
var async; try {
var local = (typeof global !== 'undefined') ? global : this; /* global Promise */
var promise = new Promise(function(){});
function checkNativePromise() { if ({}.toString.call(promise) === "[object Promise]") {
if (typeof Promise === "function" && return true;
typeof Promise.resolve === "function") { }
try { } catch (e) {}
/* global Promise */ }
var promise = new Promise(function(){}); return false;
if ({}.toString.call(promise) === "[object Promise]") { }
return true;
} function useNativePromise() {
} catch (e) {} var nativePromise = Promise.resolve();
} return function(callback, arg) {
return false; nativePromise.then(function () {
} callback(arg);
});
function useNativePromise() { };
var nativePromise = Promise.resolve(); }
return function(callback, arg) {
nativePromise.then(function () { // old node
callback(arg); function useNextTick() {
}); return function(callback, arg) {
}; process.nextTick(function() {
} callback(arg);
});
// old node };
function useNextTick() { }
return function(callback, arg) {
process.nextTick(function() { // node >= 0.10.x
callback(arg); function useSetImmediate() {
}); return function(callback, arg) {
}; /* global setImmediate */
} setImmediate(function(){
callback(arg);
// node >= 0.10.x });
function useSetImmediate() { };
return function(callback, arg) { }
/* global setImmediate */
setImmediate(function(){ function useMutationObserver() {
callback(arg); var queue = [];
});
}; var observer = new BrowserMutationObserver(function() {
} var toProcess = queue.slice();
queue = [];
function useMutationObserver() {
var queue = []; toProcess.forEach(function(tuple) {
var callback = tuple[0], arg= tuple[1];
var observer = new BrowserMutationObserver(function() { callback(arg);
var toProcess = queue.slice(); });
queue = []; });
toProcess.forEach(function(tuple) { var element = document.createElement('div');
var callback = tuple[0], arg= tuple[1]; observer.observe(element, { attributes: true });
callback(arg);
}); // Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661
}); window.addEventListener('unload', function(){
observer.disconnect();
var element = document.createElement('div'); observer = null;
observer.observe(element, { attributes: true }); }, false);
// Chrome Memory Leak: https://bugs.webkit.org/show_bug.cgi?id=93661 return function(callback, arg) {
window.addEventListener('unload', function(){ queue.push([callback, arg]);
observer.disconnect(); element.setAttribute('drainQueue', 'drainQueue');
observer = null; };
}, false); }
return function(callback, arg) { function useSetTimeout() {
queue.push([callback, arg]); return function(callback, arg) {
element.setAttribute('drainQueue', 'drainQueue'); local.setTimeout(function() {
}; callback(arg);
} }, 1);
};
function useSetTimeout() { }
return function(callback, arg) {
local.setTimeout(function() { if (checkNativePromise()) {
callback(arg); async = useNativePromise();
}, 1); } else if (typeof setImmediate === 'function') {
}; async = useSetImmediate();
} } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
async = useNextTick();
if (typeof setImmediate === 'function') { } else if (BrowserMutationObserver) {
async = useSetImmediate(); async = useMutationObserver();
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { } else {
async = useNextTick(); async = useSetTimeout();
} else if (BrowserMutationObserver) { }
async = useMutationObserver();
} else if (checkNativePromise()) {
async = useNativePromise(); __exports__.async = async;
} else { });
async = useSetTimeout(); define("rsvp/cancellation_error",
} ["exports"],
function(__exports__) {
"use strict";
__exports__.async = async; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
}); function CancellationError(message) {
define("rsvp/cancellation_error", this.name = "cancel";
["exports"], if ((message !== undefined) && (typeof message !== "string")) {
function(__exports__) { throw new TypeError('You must pass a string.');
"use strict"; }
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error this.message = message || "Default Message";
function CancellationError(message) { }
this.name = "cancel"; CancellationError.prototype = new Error();
if ((message !== undefined) && (typeof message !== "string")) { CancellationError.prototype.constructor = CancellationError;
throw new TypeError('You must pass a string.');
}
this.message = message || "Default Message"; __exports__.CancellationError = CancellationError;
} });
CancellationError.prototype = new Error(); define("rsvp/config",
CancellationError.prototype.constructor = CancellationError; ["rsvp/async","exports"],
function(__dependency1__, __exports__) {
"use strict";
__exports__.CancellationError = CancellationError; var async = __dependency1__.async;
});
define("rsvp/config", var config = {};
["rsvp/async","exports"], config.async = async;
function(__dependency1__, __exports__) {
"use strict";
var async = __dependency1__.async; __exports__.config = config;
});
var config = {}; define("rsvp/defer",
config.async = async; ["rsvp/promise","exports"],
function(__dependency1__, __exports__) {
"use strict";
__exports__.config = config; var Promise = __dependency1__.Promise;
});
define("rsvp/defer", function defer() {
["rsvp/promise","exports"], var deferred = {
function(__dependency1__, __exports__) { // pre-allocate shape
"use strict"; resolve: undefined,
var Promise = __dependency1__.Promise; reject: undefined,
promise: undefined
function defer() { };
var deferred = {
// pre-allocate shape deferred.promise = new Promise(function(resolve, reject) {
resolve: undefined, deferred.resolve = resolve;
reject: undefined, deferred.reject = reject;
promise: undefined });
};
return deferred;
deferred.promise = new Promise(function(resolve, reject) { }
deferred.resolve = resolve;
deferred.reject = reject;
}); __exports__.defer = defer;
});
return deferred; define("rsvp/events",
} ["exports"],
function(__exports__) {
"use strict";
__exports__.defer = defer; var Event = function(type, options) {
}); this.type = type;
define("rsvp/events",
["exports"], for (var option in options) {
function(__exports__) { if (!options.hasOwnProperty(option)) { continue; }
"use strict";
var Event = function(type, options) { this[option] = options[option];
this.type = type; }
};
for (var option in options) {
if (!options.hasOwnProperty(option)) { continue; } var indexOf = function(callbacks, callback) {
for (var i=0, l=callbacks.length; i<l; i++) {
this[option] = options[option]; if (callbacks[i][0] === callback) { return i; }
} }
};
return -1;
var indexOf = function(callbacks, callback) { };
for (var i=0, l=callbacks.length; i<l; i++) {
if (callbacks[i][0] === callback) { return i; } var callbacksFor = function(object) {
} var callbacks = object._promiseCallbacks;
return -1; if (!callbacks) {
}; callbacks = object._promiseCallbacks = {};
}
var callbacksFor = function(object) {
var callbacks = object._promiseCallbacks; return callbacks;
};
if (!callbacks) {
callbacks = object._promiseCallbacks = {}; var EventTarget = {
} mixin: function(object) {
object.on = this.on;
return callbacks; object.off = this.off;
}; object.trigger = this.trigger;
return object;
var EventTarget = { },
mixin: function(object) {
object.on = this.on; on: function(eventNames, callback, binding) {
object.off = this.off; var allCallbacks = callbacksFor(this), callbacks, eventName;
object.trigger = this.trigger; eventNames = eventNames.split(/\s+/);
return object; binding = binding || this;
},
while (eventName = eventNames.shift()) {
on: function(eventNames, callback, binding) { callbacks = allCallbacks[eventName];
var allCallbacks = callbacksFor(this), callbacks, eventName;
eventNames = eventNames.split(/\s+/); if (!callbacks) {
binding = binding || this; callbacks = allCallbacks[eventName] = [];
}
while (eventName = eventNames.shift()) {
callbacks = allCallbacks[eventName]; if (indexOf(callbacks, callback) === -1) {
callbacks.push([callback, binding]);
if (!callbacks) { }
callbacks = allCallbacks[eventName] = []; }
} },
if (indexOf(callbacks, callback) === -1) { off: function(eventNames, callback) {
callbacks.push([callback, binding]); var allCallbacks = callbacksFor(this), callbacks, eventName, index;
} eventNames = eventNames.split(/\s+/);
}
}, while (eventName = eventNames.shift()) {
if (!callback) {
off: function(eventNames, callback) { allCallbacks[eventName] = [];
var allCallbacks = callbacksFor(this), callbacks, eventName, index; continue;
eventNames = eventNames.split(/\s+/); }
while (eventName = eventNames.shift()) { callbacks = allCallbacks[eventName];
if (!callback) {
allCallbacks[eventName] = []; index = indexOf(callbacks, callback);
continue;
} if (index !== -1) { callbacks.splice(index, 1); }
}
callbacks = allCallbacks[eventName]; },
index = indexOf(callbacks, callback); trigger: function(eventName, options) {
var allCallbacks = callbacksFor(this),
if (index !== -1) { callbacks.splice(index, 1); } callbacks, callbackTuple, callback, binding, event;
}
}, if (callbacks = allCallbacks[eventName]) {
// Don't cache the callbacks.length since it may grow
trigger: function(eventName, options) { for (var i=0; i<callbacks.length; i++) {
var allCallbacks = callbacksFor(this), callbackTuple = callbacks[i];
callbacks, callbackTuple, callback, binding, event; callback = callbackTuple[0];
binding = callbackTuple[1];
if (callbacks = allCallbacks[eventName]) {
// Don't cache the callbacks.length since it may grow if (typeof options !== 'object') {
for (var i=0; i<callbacks.length; i++) { options = { detail: options };
callbackTuple = callbacks[i]; }
callback = callbackTuple[0];
binding = callbackTuple[1]; event = new Event(eventName, options);
callback.call(binding, event);
if (typeof options !== 'object') { }
options = { detail: options }; }
} }
};
event = new Event(eventName, options);
callback.call(binding, event);
} __exports__.EventTarget = EventTarget;
} });
} define("rsvp/hash",
}; ["rsvp/defer","exports"],
function(__dependency1__, __exports__) {
"use strict";
__exports__.EventTarget = EventTarget; var defer = __dependency1__.defer;
});
define("rsvp/hash", function size(object) {
["rsvp/defer","exports"], var s = 0;
function(__dependency1__, __exports__) {
"use strict"; for (var prop in object) {
var defer = __dependency1__.defer; s++;
}
function size(object) {
var s = 0; return s;
}
for (var prop in object) {
s++; function hash(promises) {
} var results = {}, deferred = defer(), remaining = size(promises);
return s; if (remaining === 0) {
} deferred.resolve({});
}
function hash(promises) {
var results = {}, deferred = defer(), remaining = size(promises); var resolver = function(prop) {
return function(value) {
if (remaining === 0) { resolveAll(prop, value);
deferred.resolve({}); };
} };
var resolver = function(prop) { var resolveAll = function(prop, value) {
return function(value) { results[prop] = value;
resolveAll(prop, value); if (--remaining === 0) {
}; deferred.resolve(results);
}; }
};
var resolveAll = function(prop, value) {
results[prop] = value; var rejectAll = function(error) {
if (--remaining === 0) { deferred.reject(error);
deferred.resolve(results); };
}
}; for (var prop in promises) {
if (promises[prop] && typeof promises[prop].then === 'function') {
var rejectAll = function(error) { promises[prop].then(resolver(prop), rejectAll);
deferred.reject(error); } else {
}; resolveAll(prop, promises[prop]);
}
for (var prop in promises) { }
if (promises[prop] && typeof promises[prop].then === 'function') {
promises[prop].then(resolver(prop), rejectAll); return deferred.promise;
} else { }
resolveAll(prop, promises[prop]);
}
} __exports__.hash = hash;
});
return deferred.promise; define("rsvp/node",
} ["rsvp/promise","rsvp/all","exports"],
function(__dependency1__, __dependency2__, __exports__) {
"use strict";
__exports__.hash = hash; var Promise = __dependency1__.Promise;
}); var all = __dependency2__.all;
define("rsvp/node",
["rsvp/promise","rsvp/all","exports"], function makeNodeCallbackFor(resolve, reject) {
function(__dependency1__, __dependency2__, __exports__) { return function (error, value) {
"use strict"; if (error) {
var Promise = __dependency1__.Promise; reject(error);
var all = __dependency2__.all; } else if (arguments.length > 2) {
resolve(Array.prototype.slice.call(arguments, 1));
function makeNodeCallbackFor(resolve, reject) { } else {
return function (error, value) { resolve(value);
if (error) { }
reject(error); };
} else if (arguments.length > 2) { }
resolve(Array.prototype.slice.call(arguments, 1));
} else { function denodeify(nodeFunc) {
resolve(value); return function() {
} var nodeArgs = Array.prototype.slice.call(arguments), resolve, reject;
}; var thisArg = this;
}
var promise = new Promise(function(nodeResolve, nodeReject) {
function denodeify(nodeFunc) { resolve = nodeResolve;
return function() { reject = nodeReject;
var nodeArgs = Array.prototype.slice.call(arguments), resolve, reject; });
var thisArg = this;
all(nodeArgs).then(function(nodeArgs) {
var promise = new Promise(function(nodeResolve, nodeReject) { nodeArgs.push(makeNodeCallbackFor(resolve, reject));
resolve = nodeResolve;
reject = nodeReject; try {
}); nodeFunc.apply(thisArg, nodeArgs);
} catch(e) {
all(nodeArgs).then(function(nodeArgs) { reject(e);
nodeArgs.push(makeNodeCallbackFor(resolve, reject)); }
});
try {
nodeFunc.apply(thisArg, nodeArgs); return promise;
} catch(e) { };
reject(e); }
}
});
__exports__.denodeify = denodeify;
return promise; });
}; define("rsvp/promise",
} ["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
"use strict";
__exports__.denodeify = denodeify; var config = __dependency1__.config;
}); var EventTarget = __dependency2__.EventTarget;
define("rsvp/promise", var CancellationError = __dependency3__.CancellationError;
["rsvp/config","rsvp/events","rsvp/cancellation_error","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __exports__) { function objectOrFunction(x) {
"use strict"; return isFunction(x) || (typeof x === "object" && x !== null);
var config = __dependency1__.config; }
var EventTarget = __dependency2__.EventTarget;
var CancellationError = __dependency3__.CancellationError; function isFunction(x){
return typeof x === "function";
function objectOrFunction(x) { }
return isFunction(x) || (typeof x === "object" && x !== null);
} var Promise = function(resolver, canceller) {
var promise = this,
function isFunction(x){ resolved = false;
return typeof x === "function";
} if (typeof resolver !== 'function') {
throw new TypeError('You must pass a resolver function as the sole argument to the promise constructor');
var Promise = function(resolver, canceller) { }
var promise = this,
resolved = false; if ((canceller !== undefined) && (typeof canceller !== 'function')) {
throw new TypeError('You can only pass a canceller function' +
if (typeof resolver !== 'function') { ' as the second argument to the promise constructor');
throw new TypeError('You must pass a resolver function as the sole argument to the promise constructor'); }
}
if (!(promise instanceof Promise)) {
if ((canceller !== undefined) && (typeof canceller !== 'function')) { return new Promise(resolver, canceller);
throw new TypeError('You can only pass a canceller function' + }
' as the second argument to the promise constructor');
} var resolvePromise = function(value) {
if (resolved) { return; }
if (!(promise instanceof Promise)) { resolved = true;
return new Promise(resolver, canceller); resolve(promise, value);
} };
var resolvePromise = function(value) { var rejectPromise = function(value) {
if (resolved) { return; } if (resolved) { return; }
resolved = true; resolved = true;
resolve(promise, value); reject(promise, value);
}; };
var rejectPromise = function(value) { this.on('promise:failed', function(event) {
if (resolved) { return; } this.trigger('error', { detail: event.detail });
resolved = true; }, this);
reject(promise, value);
}; this.on('error', onerror);
var notifyPromise = function(value) { this.cancel = function () {
if (resolved) { return; } // For now, simply reject the promise and does not propagate the cancel
notify(promise, value); // to parent or children
}; if (resolved) { return; }
if (canceller !== undefined) {
this.on('promise:failed', function(event) { try {
this.trigger('error', { detail: event.detail }); canceller();
}, this); } catch (e) {
rejectPromise(e);
this.on('error', onerror); return;
}
this.cancel = function () { }
// For now, simply reject the promise and does not propagate the cancel // Trigger cancel?
// to parent or children rejectPromise(new CancellationError());
if (resolved) { return; } };
if (canceller !== undefined) {
try { try {
canceller(); resolver(resolvePromise, rejectPromise);
} catch (e) { } catch(e) {
rejectPromise(e); rejectPromise(e);
return; }
} };
}
// Trigger cancel? function onerror(event) {
rejectPromise(new CancellationError()); if (config.onerror) {
}; config.onerror(event.detail);
}
try { }
resolver(resolvePromise, rejectPromise, notifyPromise);
} catch(e) { var invokeCallback = function(type, promise, callback, event) {
rejectPromise(e); var hasCallback = isFunction(callback),
} value, error, succeeded, failed;
};
if (promise.isFulfilled) { return; }
function onerror(event) { if (promise.isRejected) { return; }
if (config.onerror) {
config.onerror(event.detail); if (hasCallback) {
} try {
} value = callback(event.detail);
succeeded = true;
var invokeCallback = function(type, promise, callback, event) { } catch(e) {
var hasCallback = isFunction(callback), failed = true;
value, error, succeeded, failed; error = e;
}
if (promise.isFulfilled) { return; } } else {
if (promise.isRejected) { return; } value = event.detail;
succeeded = true;
if (hasCallback) { }
try {
value = callback(event.detail); if (handleThenable(promise, value)) {
succeeded = true; return;
} catch(e) { } else if (hasCallback && succeeded) {
failed = true; resolve(promise, value);
error = e; } else if (failed) {
} reject(promise, error);
} else { } else if (type === 'resolve') {
value = event.detail; resolve(promise, value);
succeeded = true; } else if (type === 'reject') {
} reject(promise, value);
}
if (handleThenable(promise, value)) { };
return;
} else if (hasCallback && succeeded) { Promise.prototype = {
resolve(promise, value); constructor: Promise,
} else if (failed) {
reject(promise, error); isRejected: undefined,
} else if (type === 'resolve') { isFulfilled: undefined,
resolve(promise, value); rejectedReason: undefined,
} else if (type === 'reject') { fulfillmentValue: undefined,
reject(promise, value);
} then: function(done, fail) {
}; this.off('error', onerror);
var thenPromise = new this.constructor(function() {},
var invokeNotifyCallback = function(promise, callback, event) { function () {
var value; thenPromise.trigger('promise:cancelled', {});
if (typeof callback === 'function') { });
try {
value = callback(event.detail); if (this.isFulfilled) {
} catch (e) { config.async(function(promise) {
// stop propagating invokeCallback('resolve', thenPromise, done, { detail: promise.fulfillmentValue });
return; }, this);
} }
notify(promise, value);
} else { if (this.isRejected) {
notify(promise, event.detail); config.async(function(promise) {
} invokeCallback('reject', thenPromise, fail, { detail: promise.rejectedReason });
}; }, this);
}
Promise.prototype = {
constructor: Promise, this.on('promise:resolved', function(event) {
invokeCallback('resolve', thenPromise, done, event);
isRejected: undefined, });
isFulfilled: undefined,
rejectedReason: undefined, this.on('promise:failed', function(event) {
fulfillmentValue: undefined, invokeCallback('reject', thenPromise, fail, event);
});
then: function(done, fail, progress) {
this.off('error', onerror); return thenPromise;
},
var thenPromise = new this.constructor(function() {},
function () { fail: function(fail) {
thenPromise.trigger('promise:cancelled', {}); return this.then(null, fail);
}); },
if (this.isFulfilled) { always: function(fail) {
config.async(function(promise) { return this.then(fail, fail);
invokeCallback('resolve', thenPromise, done, { detail: promise.fulfillmentValue }); }
}, this); };
}
EventTarget.mixin(Promise.prototype);
if (this.isRejected) {
config.async(function(promise) { function resolve(promise, value) {
invokeCallback('reject', thenPromise, fail, { detail: promise.rejectedReason }); if (promise === value) {
}, this); fulfill(promise, value);
} } else if (!handleThenable(promise, value)) {
fulfill(promise, value);
this.on('promise:resolved', function(event) { }
invokeCallback('resolve', thenPromise, done, event); }
});
function handleThenable(promise, value) {
this.on('promise:failed', function(event) { var then = null,
invokeCallback('reject', thenPromise, fail, event); resolved;
});
try {
this.on('promise:notified', function (event) { if (promise === value) {
invokeNotifyCallback(thenPromise, progress, event); throw new TypeError("A promises callback cannot return that same promise.");
}); }
return thenPromise; if (objectOrFunction(value)) {
}, then = value.then;
fail: function(fail) { if (isFunction(then)) {
return this.then(null, fail); promise.on('promise:cancelled', function(event) {
}, if (isFunction(value.cancel)) {
value.cancel();
always: function(fail) { }
return this.then(fail, fail); });
} then.call(value, function(val) {
}; if (resolved) { return true; }
resolved = true;
EventTarget.mixin(Promise.prototype);
if (value !== val) {
function resolve(promise, value) { resolve(promise, val);
if (promise === value) { } else {
fulfill(promise, value); fulfill(promise, val);
} else if (!handleThenable(promise, value)) { }
fulfill(promise, value); }, function(val) {
} if (resolved) { return true; }
} resolved = true;
function handleThenable(promise, value) { reject(promise, val);
var then = null, });
resolved;
return true;
try { }
if (promise === value) { }
throw new TypeError("A promises callback cannot return that same promise."); } catch (error) {
} reject(promise, error);
return true;
if (objectOrFunction(value)) { }
then = value.then;
return false;
if (isFunction(then)) { }
if (isFunction(value.on)) {
value.on('promise:notified', function (event) { function fulfill(promise, value) {
notify(promise, event.detail); config.async(function() {
}); if (promise.isFulfilled) { return; }
} if (promise.isRejected) { return; }
promise.on('promise:cancelled', function(event) { promise.trigger('promise:resolved', { detail: value });
if (isFunction(value.cancel)) { promise.isFulfilled = true;
value.cancel(); promise.fulfillmentValue = value;
} });
}); }
then.call(value, function(val) {
if (resolved) { return true; } function reject(promise, value) {
resolved = true; config.async(function() {
if (promise.isFulfilled) { return; }
if (value !== val) { if (promise.isRejected) { return; }
resolve(promise, val); promise.trigger('promise:failed', { detail: value });
} else { promise.isRejected = true;
fulfill(promise, val); promise.rejectedReason = value;
} });
}, function(val) { }
if (resolved) { return true; }
resolved = true;
__exports__.Promise = Promise;
reject(promise, val); });
}); define("rsvp/queue",
["rsvp/promise","rsvp/resolve","exports"],
return true; function(__dependency1__, __dependency2__, __exports__) {
} "use strict";
} var Promise = __dependency1__.Promise;
} catch (error) { var resolve = __dependency2__.resolve;
reject(promise, error);
return true; // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
} function ResolvedQueueError(message) {
this.name = "resolved";
return false; if ((message !== undefined) && (typeof message !== "string")) {
} throw new TypeError('You must pass a string.');
}
function fulfill(promise, value) { this.message = message || "Default Message";
config.async(function() { }
if (promise.isFulfilled) { return; } ResolvedQueueError.prototype = new Error();
if (promise.isRejected) { return; } ResolvedQueueError.prototype.constructor = ResolvedQueueError;
promise.trigger('promise:resolved', { detail: value });
promise.isFulfilled = true; var Queue = function() {
promise.fulfillmentValue = value; var queue = this,
}); promise_list = [],
} promise,
fulfill,
function reject(promise, value) { reject,
config.async(function() { resolved;
if (promise.isFulfilled) { return; }
if (promise.isRejected) { return; } if (!(this instanceof Queue)) {
promise.trigger('promise:failed', { detail: value }); return new Queue();
promise.isRejected = true; }
promise.rejectedReason = value;
}); function canceller() {
} for (var i = 0; i < 2; i++) {
promise_list[i].cancel();
function notify(promise, value) { }
config.async(function() { }
promise.trigger('promise:notified', { detail: value });
}); promise = new Promise(function(done, fail) {
} fulfill = function (fulfillmentValue) {
if (resolved) {return;}
queue.isFulfilled = true;
__exports__.Promise = Promise; queue.fulfillmentValue = fulfillmentValue;
}); resolved = true;
define("rsvp/queue", return done(fulfillmentValue);
["rsvp/promise","rsvp/resolve","exports"], };
function(__dependency1__, __dependency2__, __exports__) { reject = function (rejectedReason) {
"use strict"; if (resolved) {return;}
var Promise = __dependency1__.Promise; queue.isRejected = true;
var resolve = __dependency2__.resolve; queue.rejectedReason = rejectedReason ;
resolved = true;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error return fail(rejectedReason);
function ResolvedQueueError(message) { };
this.name = "resolved"; }, canceller);
if ((message !== undefined) && (typeof message !== "string")) {
throw new TypeError('You must pass a string.'); promise_list.push(resolve());
} promise_list.push(promise_list[0].then(function () {
this.message = message || "Default Message"; promise_list.splice(0, 2);
} if (promise_list.length === 0) {
ResolvedQueueError.prototype = new Error(); fulfill();
ResolvedQueueError.prototype.constructor = ResolvedQueueError; }
}));
var Queue = function() {
var queue = this, queue.cancel = function () {
promise_list = [], if (resolved) {return;}
promise, resolved = true;
fulfill, promise.cancel();
reject, promise.fail(function (rejectedReason) {
notify, queue.isRejected = true;
resolved; queue.rejectedReason = rejectedReason;
});
if (!(this instanceof Queue)) { };
return new Queue(); queue.then = function () {
} return promise.then.apply(promise, arguments);
};
function canceller() {
for (var i = 0; i < 2; i++) { queue.push = function(done, fail) {
promise_list[i].cancel(); var last_promise = promise_list[promise_list.length - 1],
} next_promise;
}
if (resolved) {
promise = new Promise(function(done, fail, progress) { throw new ResolvedQueueError();
fulfill = function (fulfillmentValue) { }
if (resolved) {return;}
queue.isFulfilled = true; next_promise = last_promise.then(done, fail);
queue.fulfillmentValue = fulfillmentValue; promise_list.push(next_promise);
resolved = true;
return done(fulfillmentValue); // Handle pop
}; promise_list.push(next_promise.then(function (fulfillmentValue) {
reject = function (rejectedReason) { promise_list.splice(0, 2);
if (resolved) {return;} if (promise_list.length === 0) {
queue.isRejected = true; fulfill(fulfillmentValue);
queue.rejectedReason = rejectedReason ; } else {
resolved = true; return fulfillmentValue;
return fail(rejectedReason); }
}; }, function (rejectedReason) {
notify = progress; promise_list.splice(0, 2);
}, canceller); if (promise_list.length === 0) {
reject(rejectedReason);
promise_list.push(resolve()); } else {
promise_list.push(promise_list[0].then(function () { throw rejectedReason;
promise_list.splice(0, 2); }
if (promise_list.length === 0) { }));
fulfill();
} return this;
})); };
};
queue.cancel = function () {
if (resolved) {return;} Queue.prototype = Object.create(Promise.prototype);
resolved = true; Queue.prototype.constructor = Queue;
promise.cancel();
promise.fail(function (rejectedReason) {
queue.isRejected = true; __exports__.Queue = Queue;
queue.rejectedReason = rejectedReason; __exports__.ResolvedQueueError = ResolvedQueueError;
}); });
}; define("rsvp/reject",
queue.then = function () { ["rsvp/promise","exports"],
return promise.then.apply(promise, arguments); function(__dependency1__, __exports__) {
}; "use strict";
var Promise = __dependency1__.Promise;
queue.push = function(done, fail, progress) {
var last_promise = promise_list[promise_list.length - 1], function reject(reason) {
next_promise; return new Promise(function (resolve, reject) {
reject(reason);
if (resolved) { });
throw new ResolvedQueueError(); }
}
next_promise = last_promise.then(done, fail, progress); __exports__.reject = reject;
promise_list.push(next_promise); });
define("rsvp/resolve",
// Handle pop ["rsvp/promise","exports"],
last_promise = next_promise.then(function (fulfillmentValue) { function(__dependency1__, __exports__) {
promise_list.splice(0, 2); "use strict";
if (promise_list.length === 0) { var Promise = __dependency1__.Promise;
fulfill(fulfillmentValue);
} else { function resolve(thenable) {
return fulfillmentValue; return new Promise(function(resolve, reject) {
} if (typeof thenable === "object" && thenable !== null) {
}, function (rejectedReason) { var then = thenable.then;
promise_list.splice(0, 2); if ((then !== undefined) && (typeof then === "function")) {
if (promise_list.length === 0) { return then.apply(thenable, [resolve, reject]);
reject(rejectedReason); }
} else { }
throw rejectedReason; return resolve(thenable);
} }, function () {
}, function (notificationValue) { if ((thenable !== undefined) && (thenable.cancel !== undefined)) {
if (promise_list[promise_list.length - 1] === last_promise) { thenable.cancel();
notify(notificationValue); }
} });
return notificationValue; }
});
promise_list.push(last_promise);
__exports__.resolve = resolve;
return this; });
}; define("rsvp/rethrow",
}; ["exports"],
function(__exports__) {
Queue.prototype = Object.create(Promise.prototype); "use strict";
Queue.prototype.constructor = Queue; var local = (typeof global === "undefined") ? this : global;
function rethrow(reason) {
__exports__.Queue = Queue; local.setTimeout(function() {
__exports__.ResolvedQueueError = ResolvedQueueError; throw reason;
}); });
define("rsvp/reject", throw reason;
["rsvp/promise","exports"], }
function(__dependency1__, __exports__) {
"use strict";
var Promise = __dependency1__.Promise; __exports__.rethrow = rethrow;
});
function reject(reason) { define("rsvp/timeout",
return new Promise(function (resolve, reject) { ["rsvp/promise","exports"],
reject(reason); function(__dependency1__, __exports__) {
}); "use strict";
} var Promise = __dependency1__.Promise;
function promiseSetTimeout(millisecond, should_reject, message) {
__exports__.reject = reject; var timeout_id;
});
define("rsvp/resolve", function resolver(resolve, reject) {
["rsvp/promise","exports"], timeout_id = setTimeout(function () {
function(__dependency1__, __exports__) { if (should_reject) {
"use strict"; reject(message);
var Promise = __dependency1__.Promise; } else {
resolve(message);
function resolve(thenable) { }
return new Promise(function(resolve, reject) { }, millisecond);
if (typeof thenable === "object" && thenable !== null) { }
var then = thenable.then; function canceller() {
if ((then !== undefined) && (typeof then === "function")) { clearTimeout(timeout_id);
return then.apply(thenable, [resolve, reject]); }
} return new Promise(resolver, canceller);
} }
return resolve(thenable);
}, function () { function delay(millisecond, message) {
if ((thenable !== undefined) && (thenable.cancel !== undefined)) { return promiseSetTimeout(millisecond, false, message);
thenable.cancel(); }
}
}); function timeout(millisecond) {
} return promiseSetTimeout(millisecond, true,
"Timed out after " + millisecond + " ms");
}
__exports__.resolve = resolve;
}); Promise.prototype.delay = function(millisecond) {
define("rsvp/rethrow", return this.then(function (fulfillmentValue) {
["exports"], return delay(millisecond, fulfillmentValue);
function(__exports__) { });
"use strict"; };
var local = (typeof global === "undefined") ? this : global;
function rethrow(reason) { __exports__.delay = delay;
local.setTimeout(function() { __exports__.timeout = timeout;
throw reason; });
}); define("rsvp",
throw reason; ["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],
} function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __exports__) {
"use strict";
var EventTarget = __dependency1__.EventTarget;
__exports__.rethrow = rethrow; var CancellationError = __dependency2__.CancellationError;
}); var Promise = __dependency3__.Promise;
define("rsvp/timeout", var denodeify = __dependency4__.denodeify;
["rsvp/promise","exports"], var all = __dependency5__.all;
function(__dependency1__, __exports__) { var any = __dependency5__.any;
"use strict"; var Queue = __dependency6__.Queue;
var Promise = __dependency1__.Promise; var ResolvedQueueError = __dependency6__.ResolvedQueueError;
var delay = __dependency7__.delay;
function promiseSetTimeout(millisecond, should_reject, message) { var timeout = __dependency7__.timeout;
var timeout_id; var hash = __dependency8__.hash;
var rethrow = __dependency9__.rethrow;
function resolver(resolve, reject) { var defer = __dependency10__.defer;
timeout_id = setTimeout(function () { var config = __dependency11__.config;
if (should_reject) { var resolve = __dependency12__.resolve;
reject(message); var reject = __dependency13__.reject;
} else {
resolve(message); function configure(name, value) {
} config[name] = value;
}, millisecond); }
}
function canceller() {
clearTimeout(timeout_id); __exports__.CancellationError = CancellationError;
} __exports__.Promise = Promise;
return new Promise(resolver, canceller); __exports__.EventTarget = EventTarget;
} __exports__.all = all;
__exports__.any = any;
function delay(millisecond, message) { __exports__.Queue = Queue;
return promiseSetTimeout(millisecond, false, message); __exports__.ResolvedQueueError = ResolvedQueueError;
} __exports__.delay = delay;
__exports__.timeout = timeout;
function timeout(millisecond) { __exports__.hash = hash;
return promiseSetTimeout(millisecond, true, __exports__.rethrow = rethrow;
"Timed out after " + millisecond + " ms"); __exports__.defer = defer;
} __exports__.denodeify = denodeify;
__exports__.configure = configure;
Promise.prototype.delay = function(millisecond) { __exports__.resolve = resolve;
return this.then(function (fulfillmentValue) { __exports__.reject = reject;
return delay(millisecond, fulfillmentValue); });
}); window.RSVP = requireModule("rsvp");
};
__exports__.delay = delay;
__exports__.timeout = timeout;
});
define("rsvp",
["rsvp/events","rsvp/cancellation_error","rsvp/promise","rsvp/node","rsvp/all","rsvp/queue","rsvp/timeout","rsvp/hash","rsvp/rethrow","rsvp/defer","rsvp/config","rsvp/resolve","rsvp/reject","exports"],
function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__, __dependency6__, __dependency7__, __dependency8__, __dependency9__, __dependency10__, __dependency11__, __dependency12__, __dependency13__, __exports__) {
"use strict";
var EventTarget = __dependency1__.EventTarget;
var CancellationError = __dependency2__.CancellationError;
var Promise = __dependency3__.Promise;
var denodeify = __dependency4__.denodeify;
var all = __dependency5__.all;
var any = __dependency5__.any;
var Queue = __dependency6__.Queue;
var ResolvedQueueError = __dependency6__.ResolvedQueueError;
var delay = __dependency7__.delay;
var timeout = __dependency7__.timeout;
var hash = __dependency8__.hash;
var rethrow = __dependency9__.rethrow;
var defer = __dependency10__.defer;
var config = __dependency11__.config;
var resolve = __dependency12__.resolve;
var reject = __dependency13__.reject;
function configure(name, value) {
config[name] = value;
}
__exports__.CancellationError = CancellationError;
__exports__.Promise = Promise;
__exports__.EventTarget = EventTarget;
__exports__.all = all;
__exports__.any = any;
__exports__.Queue = Queue;
__exports__.ResolvedQueueError = ResolvedQueueError;
__exports__.delay = delay;
__exports__.timeout = timeout;
__exports__.hash = hash;
__exports__.rethrow = rethrow;
__exports__.defer = defer;
__exports__.denodeify = denodeify;
__exports__.configure = configure;
__exports__.resolve = resolve;
__exports__.reject = reject;
});
window.RSVP = requireModule("rsvp");
})(window); })(window);
\ No newline at end of file
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>956.24426.45217.3157</string> </value> <value> <string>967.36619.48069.16759</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1484729690.52</float> <float>1526454424.27</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -60,7 +60,7 @@ define("rsvp/all", ...@@ -60,7 +60,7 @@ define("rsvp/all",
} }
} }
return new Promise(function(resolve, reject, notify) { return new Promise(function(resolve, reject) {
var results = [], remaining = promises.length, var results = [], remaining = promises.length,
promise, remaining_count = promises.length - expected_count; promise, remaining_count = promises.length - expected_count;
...@@ -90,12 +90,6 @@ define("rsvp/all", ...@@ -90,12 +90,6 @@ define("rsvp/all",
} }
} }
function notifier(index) {
return function(value) {
notify({"index": index, "value": value});
};
}
function cancelAll(rejectionValue) { function cancelAll(rejectionValue) {
reject(rejectionValue); reject(rejectionValue);
canceller(); canceller();
...@@ -105,7 +99,7 @@ define("rsvp/all", ...@@ -105,7 +99,7 @@ define("rsvp/all",
promise = promises[i]; promise = promises[i];
if (promise && typeof promise.then === 'function') { if (promise && typeof promise.then === 'function') {
promise.then(resolver(i), cancelAll, notifier(i)); promise.then(resolver(i), cancelAll);
} else { } else {
resolveAll(i, promise); resolveAll(i, promise);
} }
...@@ -213,14 +207,14 @@ define("rsvp/async", ...@@ -213,14 +207,14 @@ define("rsvp/async",
}; };
} }
if (typeof setImmediate === 'function') { if (checkNativePromise()) {
async = useNativePromise();
} else if (typeof setImmediate === 'function') {
async = useSetImmediate(); async = useSetImmediate();
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { } else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
async = useNextTick(); async = useNextTick();
} else if (BrowserMutationObserver) { } else if (BrowserMutationObserver) {
async = useMutationObserver(); async = useMutationObserver();
} else if (checkNativePromise()) {
async = useNativePromise();
} else { } else {
async = useSetTimeout(); async = useSetTimeout();
} }
...@@ -529,11 +523,6 @@ define("rsvp/promise", ...@@ -529,11 +523,6 @@ define("rsvp/promise",
reject(promise, value); reject(promise, value);
}; };
var notifyPromise = function(value) {
if (resolved) { return; }
notify(promise, value);
};
this.on('promise:failed', function(event) { this.on('promise:failed', function(event) {
this.trigger('error', { detail: event.detail }); this.trigger('error', { detail: event.detail });
}, this); }, this);
...@@ -557,7 +546,7 @@ define("rsvp/promise", ...@@ -557,7 +546,7 @@ define("rsvp/promise",
}; };
try { try {
resolver(resolvePromise, rejectPromise, notifyPromise); resolver(resolvePromise, rejectPromise);
} catch(e) { } catch(e) {
rejectPromise(e); rejectPromise(e);
} }
...@@ -602,22 +591,6 @@ define("rsvp/promise", ...@@ -602,22 +591,6 @@ define("rsvp/promise",
} }
}; };
var invokeNotifyCallback = function(promise, callback, event) {
var value;
if (typeof callback === 'function') {
try {
value = callback(event.detail);
} catch (e) {
// stop propagating
return;
}
notify(promise, value);
} else {
notify(promise, event.detail);
}
};
Promise.prototype = { Promise.prototype = {
constructor: Promise, constructor: Promise,
...@@ -626,7 +599,7 @@ define("rsvp/promise", ...@@ -626,7 +599,7 @@ define("rsvp/promise",
rejectedReason: undefined, rejectedReason: undefined,
fulfillmentValue: undefined, fulfillmentValue: undefined,
then: function(done, fail, progress) { then: function(done, fail) {
this.off('error', onerror); this.off('error', onerror);
var thenPromise = new this.constructor(function() {}, var thenPromise = new this.constructor(function() {},
...@@ -654,10 +627,6 @@ define("rsvp/promise", ...@@ -654,10 +627,6 @@ define("rsvp/promise",
invokeCallback('reject', thenPromise, fail, event); invokeCallback('reject', thenPromise, fail, event);
}); });
this.on('promise:notified', function (event) {
invokeNotifyCallback(thenPromise, progress, event);
});
return thenPromise; return thenPromise;
}, },
...@@ -693,11 +662,6 @@ define("rsvp/promise", ...@@ -693,11 +662,6 @@ define("rsvp/promise",
then = value.then; then = value.then;
if (isFunction(then)) { if (isFunction(then)) {
if (isFunction(value.on)) {
value.on('promise:notified', function (event) {
notify(promise, event.detail);
});
}
promise.on('promise:cancelled', function(event) { promise.on('promise:cancelled', function(event) {
if (isFunction(value.cancel)) { if (isFunction(value.cancel)) {
value.cancel(); value.cancel();
...@@ -750,12 +714,6 @@ define("rsvp/promise", ...@@ -750,12 +714,6 @@ define("rsvp/promise",
}); });
} }
function notify(promise, value) {
config.async(function() {
promise.trigger('promise:notified', { detail: value });
});
}
__exports__.Promise = Promise; __exports__.Promise = Promise;
}); });
...@@ -783,7 +741,6 @@ define("rsvp/queue", ...@@ -783,7 +741,6 @@ define("rsvp/queue",
promise, promise,
fulfill, fulfill,
reject, reject,
notify,
resolved; resolved;
if (!(this instanceof Queue)) { if (!(this instanceof Queue)) {
...@@ -796,7 +753,7 @@ define("rsvp/queue", ...@@ -796,7 +753,7 @@ define("rsvp/queue",
} }
} }
promise = new Promise(function(done, fail, progress) { promise = new Promise(function(done, fail) {
fulfill = function (fulfillmentValue) { fulfill = function (fulfillmentValue) {
if (resolved) {return;} if (resolved) {return;}
queue.isFulfilled = true; queue.isFulfilled = true;
...@@ -811,7 +768,6 @@ define("rsvp/queue", ...@@ -811,7 +768,6 @@ define("rsvp/queue",
resolved = true; resolved = true;
return fail(rejectedReason); return fail(rejectedReason);
}; };
notify = progress;
}, canceller); }, canceller);
promise_list.push(resolve()); promise_list.push(resolve());
...@@ -835,7 +791,7 @@ define("rsvp/queue", ...@@ -835,7 +791,7 @@ define("rsvp/queue",
return promise.then.apply(promise, arguments); return promise.then.apply(promise, arguments);
}; };
queue.push = function(done, fail, progress) { queue.push = function(done, fail) {
var last_promise = promise_list[promise_list.length - 1], var last_promise = promise_list[promise_list.length - 1],
next_promise; next_promise;
...@@ -843,11 +799,11 @@ define("rsvp/queue", ...@@ -843,11 +799,11 @@ define("rsvp/queue",
throw new ResolvedQueueError(); throw new ResolvedQueueError();
} }
next_promise = last_promise.then(done, fail, progress); next_promise = last_promise.then(done, fail);
promise_list.push(next_promise); promise_list.push(next_promise);
// Handle pop // Handle pop
last_promise = next_promise.then(function (fulfillmentValue) { promise_list.push(next_promise.then(function (fulfillmentValue) {
promise_list.splice(0, 2); promise_list.splice(0, 2);
if (promise_list.length === 0) { if (promise_list.length === 0) {
fulfill(fulfillmentValue); fulfill(fulfillmentValue);
...@@ -861,13 +817,7 @@ define("rsvp/queue", ...@@ -861,13 +817,7 @@ define("rsvp/queue",
} else { } else {
throw rejectedReason; throw rejectedReason;
} }
}, function (notificationValue) { }));
if (promise_list[promise_list.length - 1] === last_promise) {
notify(notificationValue);
}
return notificationValue;
});
promise_list.push(last_promise);
return this; return this;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment