Parallel Class
+ + + + +
+
+
+
+
+A concurrent parallel processor to help in running several async functions.
+ +var stack = new Y.Parallel();
+
+for (var i = 0; i < 15; i++) {
+ Y.io('./api/json/' + i, {
+ on: {
+ success: stack.add(function() {
+ Y.log('Done!');
+ })
+ }
+ });
+}
+
+stack.done(function() {
+ Y.log('All IO requests complete!');
+});
+
+
+
+
+ -
+
- Index + + +
- Methods + + +
- Properties + + + +
+
+
+
+
+
+ Item Index
+ + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+ Methods
+ + +
+
+
+
+
+
+
+ add
+
+
+
+ (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
fn+ +
+
+
+
+
+
+ Add a callback to the stack
+
+
+
+
+
+
+
+Parameters:
+ +-
+
+
-
+
+
fn+ Function + + + + +++ + +The function callback we are waiting for
+
+
+
+
+
+
+
+
+
+ done
+
+
+
+ (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
callback+ +
+
+ -
+
+
data+ +
+
+
+
+
+
+ The method to call when all the items in the stack are complete.
+
+
+
+
+
+
+
+Parameters:
+ +-
+
+
-
+
+
callback+ Function + + + + +++ + +The callback to execute on complete
+-
+
+
-
+
+
results+ Mixed + + +++ + +The results of all the callbacks in the stack
+
+
+ -
+
+
[data]+ Mixed + optional + + +++ + +The data given to the
+donemethod
+
+
+
+ -
+
+
-
+
+
data+ Mixed + + + + +++ + +Mixed data to pass to the success callback
+
+
+
+
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ test
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Test to see if all registered items in the stack have completed, if so call the callback to done
