Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vow

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vow - npm Package Compare versions

Comparing version 0.3.10 to 0.3.11

2

bower.json
{
"name" : "vow",
"version" : "0.3.9",
"version" : "0.3.11",
"main" : "lib/vow.js",
"ignore" : ["**/.*", "node_modules", "benchmarks", "test", "Makefile"]
}
Changelog
=========
0.3.10
-----
* Use `setImmediate` instead of `process.nextTick` in Node.js >= 0.10.x [#40](https://github.com/dfilatov/jspromise/issues/40)
* Up Promises/A+ Compliance Test Suite to 1.3.2
0.3.9

@@ -5,0 +10,0 @@ -----

@@ -9,3 +9,3 @@ /**

*
* @version 0.3.10
* @version 0.3.11
*/

@@ -140,11 +140,19 @@

delay : function(delay) {
return this.then(function(val) {
var promise = new Promise();
setTimeout(
function() {
promise.fulfill(val);
},
delay);
return promise;
var timer,
promise = this.then(function(val) {
var promise = new Promise();
timer = setTimeout(
function() {
promise.fulfill(val);
},
delay);
return promise;
});
promise.always(function() {
clearTimeout(timer);
});
return promise;
},

@@ -151,0 +159,0 @@

{
"name" : "vow",
"version" : "0.3.10",
"version" : "0.3.11",
"description" : "Promises/A+ proposal compatible promises library",
"homepage" : "https://github.com/dfilatov/jspromise",
"homepage" : "https://github.com/dfilatov/vow",
"keywords" : ["nodejs", "browser", "async", "promise", "a+"],

@@ -14,3 +14,3 @@ "author" : "Dmitry Filatov <dfilatov@yandex-team.ru>",

"type" : "git",
"url" : "http://github.com/dfilatov/jspromise.git"
"url" : "http://github.com/dfilatov/vow.git"
},

@@ -17,0 +17,0 @@ "dependencies": {},

<a href="http://promises-aplus.github.com/promises-spec"><img src="http://promises-aplus.github.com/promises-spec/assets/logo-small.png" align="right" /></a>
Vow [![Build Status](https://secure.travis-ci.org/dfilatov/jspromise.png)](http://travis-ci.org/dfilatov/jspromise)
Vow [![Build Status](https://secure.travis-ci.org/dfilatov/vow.png)](http://travis-ci.org/dfilatov/vow)
=========

@@ -10,3 +10,3 @@

---------------
###In the Node.js###
###In Node.js###
You can install using Node Package Manager (npm):

@@ -16,7 +16,7 @@

###In the Browsers###
###In Browsers###
```html
<script type="text/javascript" src="vow.min.js"></script>
```
Also RequireJS module format and [YM module](https://github.com/ymaps/modules) format supported.
It also supports RequireJS module format and [YM module](https://github.com/ymaps/modules) format.

@@ -47,7 +47,7 @@ Vow has been tested in IE6+, Mozilla Firefox 3+, Chrome 5+, Safari 5+, Opera 10+.

* [isPromise](#ispromisevalue)
* [when](#whenvalue-onfulfilled-onrejected-onprogress-context)
* [when](#whenvalue-onfulfilled-onrejected-onprogress-context)
* [fail](#failvalue-onrejected-context)
* [always](#alwaysvalue-onresolved-context)
* [progress](#progressvalue-onprogress-context)
* [spread](#spreadvalue-onfulfilled-onrejected-context)
* [spread](#spreadvalue-onfulfilled-onrejected-context)
* [done](#donevalue-onfulfilled-onrejected-onprogress-context)

@@ -68,30 +68,30 @@ * [isFulfilled](#isfulfilledvalue)

####Vow.promise([value])####
Create a new promise if no ````value```` given, or create a new fulfilled promise if the ````value```` is not a promise, or returns ````value```` if the given ````value```` is a promise.
Creates a new promise if no ````value```` given, or creates a new fulfilled promise if the ````value```` is not a promise, or returns ````value```` if the given ````value```` is a promise.
````javascript
var promise = Vow.promise(), // create a new promise
fulfilledPromise = Vow.promise('ok'), // create a new fulfilled promise
anotherPromise = Vow.promise(existingPromise); // anotherPromise is equal an existingPromise
var promise = Vow.promise(), // creating a new promise
fulfilledPromise = Vow.promise('ok'), // creating a new fulfilled promise
anotherPromise = Vow.promise(existingPromise); // anotherPromise is equal to the existingPromise
````
###Promise API###
####fulfill(value)####
Fulfill promise with given ````value````
Fulfills promise with given ````value````
````javascript
var promise = Vow.promise();
promise.fulfill('completed'); // fulfill promise with 'completed' value
promise.fulfill('completed'); // fulfilling promise with 'completed' value
````
####reject(reason)####
Reject promise with given ````reason````
Rejects promise with given ````reason````
````javascript
var promise = Vow.promise();
promise.reject(Error('internal error')); // reject promise with Error object
promise.reject(Error('internal error')); // rejecting promise with Error object
````
####notify(value)####
Notify promise for progress with given ````value````
Notifies promise about progress with given ````value````
````javascript
var promise = Vow.promise();
promise.notify(20); // notify promise with 20 value
promise.notify(20); // notifying promise with 20 value
````
####isFulfilled()####
Returns whether the promise is fulfilled
Returns true if the promise is fulfilled
````javascript

@@ -105,3 +105,3 @@ var promise = Vow.promise();

####isRejected()####
Returns whether the promise is rejected
Returns true if the promise is rejected
````javascript

@@ -115,3 +115,3 @@ var promise = Vow.promise();

####isResolved()####
Returns whether the promise is fulfilled or rejected
Returns true if the promise is fulfilled or rejected
````javascript

@@ -126,13 +126,13 @@ var promise = Vow.promise();

Returns value of the promise:
* value of fulfillment, if promise is fullfilled
* reason of rejection, if promise is rejected
* value of fulfillment, if promise is fullfilled
* reason of rejection, if promise is rejected
* undefined, if promise is not resolved
####then([onFulfilled], [onRejected], [onProgress], [context])####
Arranges for:
Are arranged for:
* ````onFulfilled```` to be called with the value after promise is fulfilled,
* ````onRejected```` to be called with the rejection reason after promise is rejected.
* ````onProgress```` to be called with the value when promise is notified for progress.
* ````onProgress```` to be called with the value when promise is notified about progress.
* ````context```` context of callbacks
Returns a new promise. See [Promises/A+ specification](https://github.com/promises-aplus/promises-spec) for details.

@@ -149,3 +149,3 @@ ````javascript

####fail(onRejected, [context])####
Arranges to call ````onRejected```` with given ````context```` on the promise's rejection reason if it is rejected. Shortcut for ````then(null, onRejected)````.
Arranges to call ````onRejected```` with given ````context```` on the promise rejection reason if it is rejected. Shortcut for ````then(null, onRejected)````.
````javascript

@@ -191,3 +191,3 @@ var promise = Vow.promise();

});
promise1.fulfill(1);

@@ -198,13 +198,13 @@ promise2.fulfill('two');

####done([onFulfilled], [onRejected], [onProgress], [context])####
Terminate a chain of promises. If the promise is rejected, throws it as an exception in a future turn of the event loop.
Terminates a chain of promises. If the promise is rejected, throws it as an exception in a future turn of the event loop.
````javascript
var promise = Vow.promise();
promise.reject(Error('Internal error'));
promise.done(); // exception to be throwed
promise.done(); // exception to be thrown
````
####delay(delay)####
Returns a new promise that to be fulfilled after a ````delay```` milliseconds if promise is fulfilled, or immediately rejected if promise is rejected.
Returns a new promise that will be fulfilled in ````delay```` milliseconds if the promise is fulfilled, or immediately rejected if promise is rejected.
####timeout(timeout)####
Returns a new promise that to be rejected after a ````timeout```` milliseconds if promise does not resolved beforehand.
Returns a new promise that will be rejected in ````timeout```` milliseconds if the promise is not resolved beforehand.
````javascript

@@ -222,3 +222,3 @@ var promise = Vow.promise(),

promiseWithTimeout1.fail(function(e) {
// promiseWithTimeout to be rejected after 50ms
// promiseWithTimeout to be rejected in 50ms
});

@@ -232,3 +232,3 @@

####sync(withPromise)####
Synchronize promise state with ````withPromise```` state. Shortcut for:
Synchronizes promise state with ````withPromise```` state. Shortcut for:
````javascript

@@ -241,2 +241,5 @@ withPromise.then(

promise.reject(err);
},
function(val) {
promise.notify(val);
});

@@ -248,3 +251,3 @@ ````

####isPromise(value)####
Returns whether the given ````value```` is a promise.
Returns true if the given ````value```` is a promise.
````javascript

@@ -256,32 +259,32 @@ Vow.isPromise('value'); // returns false

####when(value, [onFulfilled], [onRejected], [onProgress], [context])####
Static equivalent for [promise.then](#thenonfulfilled-onrejected-onprogress-context). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.then](#thenonfulfilled-onrejected-onprogress-context). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####fail(value, onRejected, [context])####
Static equivalent for [promise.fail](#failonrejected-context). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.fail](#failonrejected-context). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####always(value, onResolved, [context])####
Static equivalent for [promise.always](#alwaysonresolved-context). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.always](#alwaysonresolved-context). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####progress(value, onProgress, [context])####
Static equivalent for [promise.progress](#progressonprogress-context). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.progress](#progressonprogress-context). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####spread(value, [onFulfilled], [onRejected], [context])####
Static equivalent for [promise.spread](#spreadonfulfilled-onrejected-context).
If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.spread](#spreadonfulfilled-onrejected-context).
If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####done(value, [onFulfilled], [onRejected], [onProgress], [context]])####
Static equivalent for [promise.done](#doneonfulfilled-onrejected-onprogress-context).
If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.done](#doneonfulfilled-onrejected-onprogress-context).
If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####isFulfilled(value)####
Static equivalent for [promise.isFulfilled](#isfulfilled).
If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.isFulfilled](#isfulfilled).
If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####isRejected(value)####
Static equivalent for [promise.isRejected](#isrejected).
If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.isRejected](#isrejected).
If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####isResolved(value)####
Static equivalent for [promise.isResolved](#isresolved).
If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.isResolved](#isresolved).
If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.

@@ -300,5 +303,5 @@ ####fulfill(value)####

* will be fulfilled with returned value if value is not a promise
* will be returned value if value is a promise
* will be rejected if function throw exception
* value will be returned if value is a promise
````javascript

@@ -319,3 +322,3 @@ var promise1 = Vow.invoke(function(value) {

####all(promisesOrValues)####
Returns a promise to be fulfilled only after all items in ````promisesOrValues```` is fulfilled, or to be rejected when the any promise is rejected.
Returns a promise to be fulfilled only after all the items in ````promisesOrValues```` are fulfilled, or to be rejected when any of the promises is rejected.

@@ -326,3 +329,3 @@ ````promisesOrValues```` can be Array:

promise2 = Vow.promise();
Vow.all([promise1, promise2, 3])

@@ -340,3 +343,3 @@ .then(function(value) {

promise2 = Vow.promise();
Vow.all({ a : promise1, b : promise2, c : 3 })

@@ -352,7 +355,7 @@ .then(function(value) {

####allResolved(promisesOrValues)####
Returns a promise to be fulfilled only after all items in ````promisesOrValues```` is resolved.
Returns a promise to be fulfilled only after all the items in ````promisesOrValues```` are resolved.
````javascript
var promise1 = Vow.promise(),
promise2 = Vow.promise();
Vow.allResolved([promise1, promise2])

@@ -369,8 +372,8 @@ .spread(function(promise1, promise2) {

####any(promisesOrValues)####
Returns a promise to be fulfilled only any item in ````promisesOrValues```` is fulfilled, or to be rejected when all items is rejected (with reason of first rejected item).
Returns a promise to be fulfilled only when any of the items in ````promisesOrValues```` are fulfilled, or to be rejected when all the items are rejected (with the reason of the first rejected item).
####delay(value, delay)####
Static equivalent for [promise.delay](#delaydelay). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.delay](#delaydelay). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
####timeout(value, timeout)####
Static equivalent for [promise.timeout](#timeouttimeout). If given ````value```` is not a promise, ````value```` is equivalent to fulfilled promise.
Static equivalent to [promise.timeout](#timeouttimeout). If given ````value```` is not a promise, then ````value```` is equivalent to fulfilled promise.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc