Browse files

cleaning up a bit of things, added .gitignore

  • Loading branch information...
1 parent a641f82 commit c30a1d4b90950871490208f285e3d69a16bf9710 @brentlintner brentlintner committed Sep 16, 2010
Showing with 12 additions and 12 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 jworkflow-min-0.1.0.js
  3. +10 −11 jworkflow.js
View
1 .gitignore
@@ -0,0 +1 @@
+.redcar
View
2 jworkflow-min-0.1.0.js
@@ -1,2 +1,2 @@
-var jWorkflow=function(){return{order:function(h,i){var c=[],e=function(){var a=false,b=null;return{take:function(){a=true},pass:function(){var d,f;for(a=false;c.length;){f=c.shift();d=f.func.apply(f.context,[d,e]);if(e.taken())return}c.length<1&&b&&b.apply()},start:function(d){b=d;e.pass()},taken:function(){return a}}}(),g={andThen:function(a,b){if(typeof a!=="function")throw"expected function but was "+typeof a;c.push({func:a,context:b});return g},start:function(a){e.start(a)}};return g.andThen(h,
+var jWorkflow=function(){return{order:function(h,i){var c=[],d,e=function(){var a=false;d=null;return{take:function(){a=true},pass:function(){var b,f;for(a=false;c.length;){f=c.shift();b=f.func.apply(f.context,[b,e]);if(e.taken())return}c.length<1&&d&&d.apply()},start:function(b){d=b;e.pass()},taken:function(){return a}}}(),g={andThen:function(a,b){if(typeof a!=="function")throw"expected function but was "+typeof a;c.push({func:a,context:b});return g},start:function(a){e.start(a)}};return g.andThen(h,
i)}}}();
View
21 jworkflow.js
@@ -10,27 +10,26 @@ var jWorkflow = (function () {
}
var transfunctioner = {
-
order: function (func, context) {
var _tasks = [],
_callback,
- _baton = (function() {
+ _baton = (function () {
var _taken = false;
- var _callback = null;
+ _callback = null;
return {
- take: function() {
+ take: function () {
_taken = true;
},
- pass: function() {
+ pass: function () {
var result, task;
_taken = false;
- while(_tasks.length) {
+ while (_tasks.length) {
task = _tasks.shift();
result = task.func.apply(task.context, [result, _baton]);
- if(_baton.taken()) {
+ if (_baton.taken()) {
return;
}
}
@@ -40,12 +39,12 @@ var jWorkflow = (function () {
}
},
- start: function(callback) {
+ start: function (callback) {
_callback = callback;
_baton.pass();
},
- taken: function() {
+ taken: function () {
return _taken;
}
};
@@ -63,9 +62,9 @@ var jWorkflow = (function () {
}
};
- return self.andThen(func, context);
+ return self.andThen(func, context);
}
};
return transfunctioner;
-})();
+}());

0 comments on commit c30a1d4

Please sign in to comment.