Produce a side effect only after all of the Law events occur

@function whenAll
@name whenAll
@instance
@memberof Law
326832
function() {
    var streams = this.sourceStreams = toArray(arguments);

    if(streams.length === 1) {
      this.any.apply(this, streams);
      return this;
    }

    this.resultStream = Bacon.zipAsArray(streams);

    this.streamsHash = this._computeStreamsHash('all', streams);

    // invalidate 'any'
    return this;
  }
39023
function removeAll (state, prefix, filter) {
  var docs

  var options = {
    include_docs: true
  }

  if (prefix) {
    options.startkey = prefix
    options.endkey = prefix + '\uffff'
  }

  return state.db.allDocs(options)

  .then(function (res) {
    docs = res.rows
      .filter(isntDesignDoc)
      .map(function (row) {
        return row.doc
      })

    if (typeof filter === 'function') {
      docs = docs.filter(filter)
    }

    return docs.map(function (doc) {
      doc._deleted = true
      return addTimestamps(doc)
    })
  })

  .then(bulkDocs.bind(null, state))
}
161271
function handler(instance, context, func, index, callback) {
	return function() {
		var old = instance.results[index];
		instance.results[index] = tryExpr(func, context);
		if (old === instance.results[index])
			return;
		if (instance.dependenciesCount === 1 || !Interpolable.allowDelayedUpdate)
			callback(instance.output(context), 'set');
		else if (!instance.willFire)
			instance.willFire = context.delay(function() { // call on nextTick to manage other dependencies update without multiple rerender
				if (instance.willFire) {
					instance.willFire = null;
					callback(instance.output(context), 'set');
				}
			}, 0);
	};
}
840410
function allOffFor(o) {
            var eH = this[_eventHandlers];
            var _iteratorNormalCompletion = true;
            var _didIteratorError = false;
            var _iteratorError = undefined;

            try {
                for (var _iterator = eH[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
                    var _step$value = _slicedToArray(_step.value, 2);

                    var evt = _step$value[0];
                    var objMap = _step$value[1];

                    if (objMap !== undefined) {
                        objMap["delete"](o);
                    }
                }
            } catch (err) {
                _didIteratorError = true;
                _iteratorError = err;
            } finally {
                try {
                    if (!_iteratorNormalCompletion && _iterator["return"]) {
                        _iterator["return"]();
                    }
                } finally {
                    if (_didIteratorError) {
                        throw _iteratorError;
                    }
                }
            }

            return this;
        }
24615
function each(collection, fn, scope) {
  var i = 0,
    cont;

  for (i; i < collection.length; i++) {
    cont = fn.call(scope, collection[i], i);
    if (cont === false) {
      break; //allow early exit
    }
  }
}
337526
function effects() {
		extend(window, {
			requestAnimationFrame: (function() {
				var func =
					window.requestAnimationFrame ||
					window.webkitRequestAnimationFrame ||
					window.mozRequestAnimationFrame ||
					window.oRequestAnimationFrame ||
					window.msRequestAnimationFrame ||
					(function() {
						var lastTime = 0;
						return function(callback, element) {
							var currTime = new Date().getTime();
							var timeToCall = Math.max(0, 16 - (currTime - lastTime));
							var id = window.setTimeout(function() {
									callback(currTime + timeToCall);
								},
								timeToCall);
							lastTime = currTime + timeToCall;
							return id;
						};
					}());
				return func;
			})(),
			cancelAnimationFrame: (function() {
				return (
					window.cancelAnimationFrame ||
					window.webkitCancelAnimationFrame ||
					window.mozCancelAnimationFrame ||
					window.oCancelAnimationFrame ||
					window.msCancelAnimationFrame ||
					clearTimeout
				);
			}()),
			/*
			 * TODO: Internalize into gui.Tick
			 * TODO: Move to MessageChannel!!!
			 */
			setImmediate: (function() {
				var list = [],
					handle = 1;
				var name = "spiritual:emulated:setimmediate";
				window.addEventListener("message", function(e) {
					if (e.data === name && list.length) {
						list.shift().apply(window);
						e.stopPropagation();
					}
				}, false);
				return function emulated(func) {
					list.push(func);
					window.postMessage(name, "*");
					return handle++;
				};
			})()
		});
	}
568338
function(ev, attr, how, newVal, oldVal) {
                    // when a change happens, create the named event.
                    can.batch.trigger(this, {
                            type: attr,
                            batchNum: ev.batchNum
                        }, [newVal, oldVal]);

                    if (how === "remove" || how === "add") {
                        can.batch.trigger(this, {
                                type: "__keys",
                                batchNum: ev.batchNum
                            });
                    }
                }
695574
function() {

    this.on = this.addEventListener = function(type, listener) {
        if (!this.events[type]) {
            this.events[type] = [];
        }

        this.events[type].push(listener);
    };

    this.off = this.removeEventListener = function (type, listener) {
        if (!!this.events[type]) {
            for(var i = 0; i < this.events[type].length; i++) {
                if (this.events[type][i] === listener) {
                    this.events[type][i] = null;
                    this.events[type].splice(i, 1);
                    return;
                }
            }
        }
    };

    this.removeAllListeners = function (type) {
        this.events[type] = [];
    };

    var emit = function(cb, event) {
        // Handle callbacks asynchronously
        setTimeout(function() {
            cb(event);
        }, 0);

    };

    this.dispatchEvent = function (event) {
        if (!!event.type) {
            var type = event.type;
            if (!!this.events[type]) {
                event.target = this;
                for (var i = 0; i < this.events[type].length && (event.returnValue === undefined || event.returnValue) ; i++) {
                    var cb = this.events[type][i];
                    // Dereference cb for async
                    emit(cb.bind(event.target), event);
                }
            }
        }
    };
}
674654
function setAlltoNoop (obj, methods) {
    utils.each(methods, function (method) {
        obj[method] = noop
    })
}
1076450
function visitAll(state, paths, cwd, one, done) {
  var expected = paths.length
  var actual = -1
  var result = []

  paths.forEach(each)

  next()

  function each(filePath) {
    visit(state, join(cwd || '', filePath), one, onvisit)
  }

  function onvisit(files) {
    result = result.concat(files)
    next()
  }

  function next() {
    actual++

    if (actual === expected) {
      done(result)
    }
  }
}
456146
function _guardPromiseAll (promises, all, callback) {
  if (promises.length === 0) {
    callback()
  } else {
    all(promises).then(() => {
      callback()
    })
  }
}
20150
function rethrow(error) {
        if (filterTree && error instanceof filterTree.Error) {
            alert(error);
            reveal(error);
        } else if (error) {
            throw error;
        }

        return error;
    }
465068
function(oArgs) {
    //TODO: filter for all spurious events at a lower level
    if(!Dom.isAncestor(oArgs.target,Ev.getRelatedTarget(oArgs.event))) {
        this.unhighlightColumn(oArgs.target);
    }
}
300610
function() {
        var queue = this._queue;
        var globalOptions = this.globalOptions;
        var options = this.options;
        var before = options && options.before;
        var after = options && options.after;
        var onError = globalOptions.onError || (globalOptions.onErrorTarget && globalOptions.onErrorTarget[globalOptions.onErrorMethod]);
        var target, method, args, stack, i, l = queue.length;

        this.targetQueues = Object.create(null);

        if (l && before) { before(); }
        for (i = 0; i < l; i += 4) {
          target = queue[i];
          method = queue[i+1];
          args   = queue[i+2];
          stack  = queue[i+3]; // Debugging assistance

          // TODO: error handling
          if (args && args.length > 0) {
            if (onError) {
              try {
                method.apply(target, args);
              } catch (e) {
                onError(e);
              }
            } else {
              method.apply(target, args);
            }
          } else {
            if (onError) {
              try {
                method.call(target);
              } catch(e) {
                onError(e);
              }
            } else {
              method.call(target);
            }
          }
        }
        if (l && after) { after(); }

        // check if new items have been added
        if (queue.length > l) {
          this._queue = queue.slice(l);
          this.flush();
        } else {
          this._queue.length = 0;
        }
      }
306970
function( type ) {
                var args, events, allEvents;
    
                if ( !this._events || !type ) {
                    return this;
                }
    
                args = slice.call( arguments, 1 );
                events = findHandlers( this._events, type );
                allEvents = findHandlers( this._events, 'all' );
    
                return triggerHanders( events, args ) &&
                        triggerHanders( allEvents, arguments );
            }
927020
function eachProp(obj, func) {
        var prop;
        for (prop in obj) {
            if (hasProp(obj, prop)) {
                if (func(obj[prop], prop)) {
                    break;
                }
            }
        }
    }
995139
def filter_callbacks(cls, client, event_data):
        """"""

        for event in cls.filter_events(client, event_data):
            for cb in event.callbacks:
                yield cb