Comparing version 0.7.1-2 to 0.7.1-3
21
API.md
@@ -51,3 +51,3 @@ #API Reference | ||
- [Promise.promisify\(Function nodeFunction \[, dynamic receiver\]\)](#promisepromisifyfunction-nodefunction--dynamic-receiver---function) | ||
- [Promise.noConflict\(\)](#promisenoconflict---object) | ||
##Core | ||
@@ -572,2 +572,21 @@ | ||
}); | ||
``` | ||
#####`Promise.noConflict()` -> `Object` | ||
This is relevant to browser environments with no module loader. | ||
Release control of the `Promise` namespace to whatever it was before this library was loaded. Returns a reference to the library namespace so you can attach it to something else. | ||
```html | ||
<!-- the other promise library must be loaded first --> | ||
<script type="text/javascript" src="/scripts/other_promise.js"></script> | ||
<script type="text/javascript" src="/scripts/bluebird_debug.js"></script> | ||
<script type="text/javascript"> | ||
//Release control right after | ||
var Bluebird = Promise.noConflict(); | ||
//Cast a promise from some other Promise library using the Promise namespace to Bluebird: | ||
var promise = Bluebird.cast(new Promise()); | ||
</script> | ||
``` |
/* jshint -W014, -W116, -W106 */ | ||
/* global process, unreachable */ | ||
/* global process */ | ||
/** | ||
@@ -391,2 +391,3 @@ * @preserve Copyright (c) 2013 Petka Antonov | ||
var MESSAGE_KEY = "bluebird_message_key_" + Math.random(); | ||
deferFn = (function(){ | ||
@@ -397,3 +398,3 @@ var queuedFn = void 0; | ||
if(e.source === global && | ||
e.data === "bluebird_message_key_0.4375570372212678") { | ||
e.data === MESSAGE_KEY) { | ||
var fn = queuedFn; | ||
@@ -410,3 +411,3 @@ queuedFn = void 0; | ||
global.postMessage( | ||
"bluebird_message_key_0.4375570372212678", "*" | ||
MESSAGE_KEY, "*" | ||
); | ||
@@ -807,3 +808,3 @@ }; | ||
}; | ||
return this._then( r, r, void 0, this, void 0, this.anyway ); | ||
return this._then( r, r, void 0, this, void 0, this.lastly ); | ||
}; | ||
@@ -1313,6 +1314,5 @@ | ||
} | ||
else if( this.isRejected() ) { | ||
else { | ||
fn = this._rejectAt( index ); | ||
} | ||
else unreachable(); | ||
@@ -1808,7 +1808,16 @@ var obj = this._resolvedValue; | ||
var old = global.Promise; | ||
Promise.noConflict = function() { | ||
if( global.Promise === Promise ) { | ||
global.Promise = old; | ||
} | ||
return Promise; | ||
}; | ||
if( !CapturedTrace.isSupported() ) { | ||
Promise.longStackTraces = void 0; | ||
CapturedTrace.possiblyUnhandledRejection = void 0; | ||
Promise.onPossiblyUnhandledRejection = void 0; | ||
Promise.longStackTraces = function(){}; | ||
CapturedTrace.possiblyUnhandledRejection = function(){}; | ||
Promise.onPossiblyUnhandledRejection = function(){}; | ||
longStackTraces = false; | ||
@@ -1822,2 +1831,3 @@ } | ||
return Promise;})(); | ||
@@ -1824,0 +1834,0 @@ |
{ | ||
"name": "bluebird", | ||
"description": "Full featured Promises/A+ implementation with exceptionally good performance", | ||
"version": "0.7.1-2", | ||
"version": "0.7.1-3", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "promise", |
/* jshint -W014, -W116, -W106 */ | ||
/* global process, unreachable */ | ||
/* global process */ | ||
/** | ||
@@ -4,0 +4,0 @@ * @preserve Copyright (c) 2013 Petka Antonov |
@@ -182,3 +182,3 @@ var Promise = (function() { | ||
/** | ||
* Convenience method for .then( fn, fn ); | ||
* Like Q Finally | ||
* | ||
@@ -198,3 +198,3 @@ * @param {Function} fn The callback to call when this promise is | ||
}; | ||
return this._then( r, r, void 0, this, void 0, this.anyway ); | ||
return this._then( r, r, void 0, this, void 0, this.lastly ); | ||
}; | ||
@@ -1063,9 +1063,9 @@ | ||
ASSERT( this.isFulfilled() || this.isRejected() ); | ||
if( this.isFulfilled() ) { | ||
fn = this._fulfillAt( index ); | ||
} | ||
else if( this.isRejected() ) { | ||
else { | ||
fn = this._rejectAt( index ); | ||
} | ||
else unreachable(); | ||
@@ -1619,7 +1619,16 @@ var obj = this._resolvedValue; | ||
var old = global.Promise; | ||
Promise.noConflict = function() { | ||
if( global.Promise === Promise ) { | ||
global.Promise = old; | ||
} | ||
return Promise; | ||
}; | ||
if( !CapturedTrace.isSupported() ) { | ||
Promise.longStackTraces = void 0; | ||
CapturedTrace.possiblyUnhandledRejection = void 0; | ||
Promise.onPossiblyUnhandledRejection = void 0; | ||
Promise.longStackTraces = function(){}; | ||
CapturedTrace.possiblyUnhandledRejection = function(){}; | ||
Promise.onPossiblyUnhandledRejection = function(){}; | ||
longStackTraces = false; | ||
@@ -1633,4 +1642,5 @@ } | ||
return Promise;})(); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207081
5217