Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var App = function(start, cb) {
- var pendingRecursive = 0;
- var eventEmitter = new EventEmitter();
- cb(eventEmitter);
- var Recursive = function(a) {
- // breadth-first search recursion
- // before each recursive call:
- pendingRecursive++;
- Recursive(/*whatever*/);
- // at the end of the function
- if (--activeRecursive == 0){
- eventEmitter.emit('end');
- }
- }
- pendingRecursive = 1;
- Rec
Add Comment
Please, Sign In to add comment