Permalink
Browse files

Merge arguments from parallel tasks and pass to the next task

  • Loading branch information...
1 parent f24a71a commit 4a12f2880b870d0d8cc50743efeaf1a679003655 @ben-lin ben-lin committed Jan 16, 2012
Showing with 33 additions and 11 deletions.
  1. +6 −0 History.md
  2. +25 −9 lib/flow.js
  3. +2 −2 package.json
View
@@ -1,3 +1,9 @@
+## 0.0.2 / 2012-01-16
+
+ - Merge arguments from parallel tasks and pass to the next task
+
+
+
## 0.0.1 / 2012-01-10
- Initial release
View
@@ -113,14 +113,21 @@ Flow.prototype = {
* @private
* @this {Flow}
*/
- _run_parallel : function (){
- var self = this;
- var args = this._parallel_args.shift();
-
- this._count = args.length;
+ _run_parallel : function ( args ){
+ var self = this;
+ var parallel_args = this._parallel_args.shift();
+ var args_form_last_task = args;
+ this._count = parallel_args.length;
this._parallel.shift().forEach( function ( task ){
- task.apply( self, args.shift());
+ var _args = parallel_args.shift();
+
+ if( args_form_last_task.length > 0 ){
+
+ _args.unshift( args_form_last_task );
+ }
+
+ task.apply( self, _args );
});
this._group--;
@@ -280,7 +287,16 @@ Flow.prototype = {
var self = this;
this.series( function (){
- self._run_parallel();
+ var args;
+
+ if( arguments.length === 1 ){
+ args = [];
+ }else{
+ [].pop.call( arguments );
+ args = arguments[ 0 ];
+ }
+
+ self._run_parallel( args );
});
this._group++;
@@ -335,9 +351,9 @@ Flow.prototype = {
/**
* @public
- * @version 0.0.1
+ * @version 0.0.2
*/
-Flow.version = '0.0.1';
+Flow.version = '0.0.2';
View
@@ -1,11 +1,11 @@
{
"name" : "node.flow",
- "version" : "0.0.1",
+ "version" : "0.0.2",
"description" : "A deadly simple flow control package for node.js",
"keywords" : [ "flow", "node.flow", "flow control", "async", "sync", "steps" ],
"author" : "dreamerslab <ben@dreamerslab.com>",
"dependencies" : {
- "node.extend" : ">=0.0.1"
+ "node.extend" : ""
},
"repository": {
"type": "git",

0 comments on commit 4a12f28

Please sign in to comment.