Commit cb2baafc authored by Pascal Hartig's avatar Pascal Hartig

Olives: Update Emily dep

parent 809268b6
...@@ -26,10 +26,10 @@ function Tools(){ ...@@ -26,10 +26,10 @@ function Tools(){
* @returns {Object} the global object * @returns {Object} the global object
*/ */
getGlobal: function getGlobal() { getGlobal: function getGlobal() {
var func = function() { var func = function() {
return this; return this;
}; };
return func.call(null); return func.call(null);
}, },
/** /**
...@@ -822,43 +822,43 @@ function Promise(Observable, StateMachine) { ...@@ -822,43 +822,43 @@ function Promise(Observable, StateMachine) {
* @returns {Promise} the new promise * @returns {Promise} the new promise
*/ */
this.then = function then() { this.then = function then() {
var promise = new PromiseConstructor; var promise = new PromiseConstructor;
// If a fulfillment callback is given // If a fulfillment callback is given
if (arguments[0] instanceof Function) { if (arguments[0] instanceof Function) {
// If the second argument is also a function, then no scope is given // If the second argument is also a function, then no scope is given
if (arguments[1] instanceof Function) { if (arguments[1] instanceof Function) {
_stateMachine.event("toFulfill", this.makeResolver(promise, arguments[0])); _stateMachine.event("toFulfill", this.makeResolver(promise, arguments[0]));
} else { } else {
// If the second argument is not a function, it's the scope // If the second argument is not a function, it's the scope
_stateMachine.event("toFulfill", this.makeResolver(promise, arguments[0], arguments[1])); _stateMachine.event("toFulfill", this.makeResolver(promise, arguments[0], arguments[1]));
} }
} else { } else {
// If no fulfillment callback given, give a default one // If no fulfillment callback given, give a default one
_stateMachine.event("toFulfill", this.makeResolver(promise, function () { _stateMachine.event("toFulfill", this.makeResolver(promise, function () {
promise.fulfill(_value); promise.fulfill(_value);
})); }));
} }
// if the second arguments is a callback, it's the rejection one, and the next argument is the scope // if the second arguments is a callback, it's the rejection one, and the next argument is the scope
if (arguments[1] instanceof Function) { if (arguments[1] instanceof Function) {
_stateMachine.event("toReject", this.makeResolver(promise, arguments[1], arguments[2])); _stateMachine.event("toReject", this.makeResolver(promise, arguments[1], arguments[2]));
} }
// if the third arguments is a callback, it's the rejection one, and the next arguments is the sopce // if the third arguments is a callback, it's the rejection one, and the next arguments is the sopce
if (arguments[2] instanceof Function) { if (arguments[2] instanceof Function) {
_stateMachine.event("toReject", this.makeResolver(promise, arguments[2], arguments[3])); _stateMachine.event("toReject", this.makeResolver(promise, arguments[2], arguments[3]));
} }
// If no rejection callback is given, give a default one // If no rejection callback is given, give a default one
if (!(arguments[1] instanceof Function) && if (!(arguments[1] instanceof Function) &&
!(arguments[2] instanceof Function)) { !(arguments[2] instanceof Function)) {
_stateMachine.event("toReject", this.makeResolver(promise, function () { _stateMachine.event("toReject", this.makeResolver(promise, function () {
promise.reject(_reason); promise.reject(_reason);
})); }));
} }
return promise; return promise;
}; };
/** /**
...@@ -912,7 +912,7 @@ function Promise(Observable, StateMachine) { ...@@ -912,7 +912,7 @@ function Promise(Observable, StateMachine) {
* @private * @private
*/ */
this.getReason = function getReason() { this.getReason = function getReason() {
return _reason; return _reason;
}; };
/** /**
...@@ -921,7 +921,7 @@ function Promise(Observable, StateMachine) { ...@@ -921,7 +921,7 @@ function Promise(Observable, StateMachine) {
* @private * @private
*/ */
this.getValue = function getValue() { this.getValue = function getValue() {
return _value; return _value;
}; };
/** /**
......
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