Comparing version 0.0.9 to 0.0.10
@@ -74,6 +74,7 @@ var Deferred = function () { | ||
if (_state === PENDING) { | ||
var _args = arguments; | ||
for (var index in _progressCallbacks) { | ||
(function(i){ | ||
setTimeout(function() { | ||
_progressCallbacks[i].apply(null, arguments); | ||
_progressCallbacks[i].apply(null, _args); | ||
},0); | ||
@@ -80,0 +81,0 @@ })(index); |
{ | ||
"name": "asynk", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "Asynk is a feature-rich JavaScript library designed to simplify common asynchronous JavaScript programming tasks.", | ||
@@ -5,0 +5,0 @@ "main": "asynk.js", |
@@ -209,16 +209,16 @@ ![asynk.js](http://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Break_dance.svg/512px-Break_dance.svg.png)Asynk.js | ||
### Asynk.deffered | ||
*asynk.deffered()* | ||
### Asynk.deferred | ||
*asynk.deferred()* | ||
A factory function that returns a chainable utility object with methods to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. | ||
return: a deffered object | ||
return: a deferred object | ||
```javascript | ||
var defered = asynk.deferred(); | ||
var promise = defered.promise(); | ||
var deferred = asynk.deferred(); | ||
var promise = deferred.promise(); | ||
promise.done(function(arg){ | ||
console.log('hello ' + arg); | ||
}); | ||
defered.resolve('world'); | ||
deferred.resolve('world'); | ||
``` | ||
@@ -234,3 +234,3 @@ | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -245,3 +245,3 @@ ### Done | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -256,3 +256,3 @@ ### Fail | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -281,3 +281,3 @@ ### IsRejected | ||
return: the deffered object | ||
return: the deferred object | ||
@@ -293,3 +293,3 @@ ### NotifyWith | ||
return: the deffered object | ||
return: the deferred object | ||
@@ -314,3 +314,3 @@ ### Pipe | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -335,3 +335,3 @@ ### Promise | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -347,3 +347,3 @@ ### RejectWith | ||
return: the deffered object | ||
return: the deferred object | ||
@@ -358,3 +358,3 @@ ### Resolve | ||
return: the deffered/promise object | ||
return: the deferred/promise object | ||
@@ -370,3 +370,3 @@ ### ResolveWith | ||
return: the deffered object | ||
return: the deferred object | ||
@@ -461,2 +461,2 @@ ### State | ||
console.log(result); //123456 | ||
``` | ||
``` |
@@ -56,3 +56,17 @@ var assert = require('assert'); | ||
}); | ||
it('Deferred notify(args) should execute promise progress(args)', function (done) { | ||
var d1 = asynk.deferred(); | ||
var p1 = d1.promise(); | ||
var Notify = null; | ||
var Obj = {}; | ||
p1.progress(function(notify) { | ||
Notify = notify; | ||
}); | ||
d1.notify(Obj); | ||
d1.resolve(); | ||
p1.done(function() { | ||
assert(Notify === Obj); | ||
done(); | ||
}); | ||
}); | ||
it('then should return a new promise and transform results', function (done) { | ||
@@ -59,0 +73,0 @@ var promiseOfPerson = asynk.deferred(); |
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
68278
1482
451