basic-promise
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -73,8 +73,3 @@ 'use strict'; | ||
}; | ||
p.last = function(){ | ||
return promises[promises.length-1]; | ||
}; | ||
p.first = function(){ | ||
return promises[0]; | ||
}; | ||
p.promises = promises; | ||
var promisesResult = {}; | ||
@@ -81,0 +76,0 @@ var rejects = 0; |
{ | ||
"name": "basic-promise", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Module promise with a simple syntax", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -14,3 +14,3 @@ ## Usage | ||
console.log('ERROR') | ||
}, function(){ // => The promise id complete (after rolve or reject) | ||
}, function(){ // => The promise is complete (after resolve or reject) | ||
console.log('COMPLETE'); | ||
@@ -29,3 +29,3 @@ }); | ||
}) | ||
.on('complete', function(){ // => The promise id complete (after rolve or reject) | ||
.on('complete', function(){ // => The promise is complete (after resolve or reject) | ||
console.log('COMPLETE'); | ||
@@ -69,5 +69,11 @@ }); | ||
//Only with multiple promises | ||
p.promises; //Return an array of promises | ||
p.eq(2); //Returns the promise to fix the position 2 (the position is 0 to infinite) | ||
p.first(); //Return the first promise | ||
p.last(); //Return the last promise | ||
//trigger all | ||
p.promises.forEach(function(promise, position){ | ||
promise.resolve('This promise is: '+position); | ||
}); | ||
//Here execute the resolve event in the multiple promise => console.log('All the promises is resolve'); | ||
``` |
6019
76
102