lib/law.js
function(autocrat, governor, origHandler, context) {
    var streamsHash = this.streamsHash,
        handlerSequence, isFirstHandler, deferred, handler;

    context || (context = this.governor);

    if(isFunction(origHandler)) {
      origHandler = bind(origHandler, context);
    } else if(isString(origHandler)){
      origHandler = bind(this.governor[origHandler], context);
    }

    if(autocrat.awaiting[this.streamsHash]) {
      handlerSequence = autocrat.awaiting[this.streamsHash];
    } else {
      handlerSequence = autocrat.awaiting[this.streamsHash] = [];
      isFirstHandler = true;
    }

    deferred = new HandlerDeferred(handlerSequence);
    handler = this._buildAsyncHandler(origHandler, deferred);

    if(isFirstHandler) {
      deferred.handlerIndex = 0;
      handlerSequence.push(handler);
      this.resultStream.subscribe(handler);
    } else {
      deferred.handlerIndex = handlerSequence.length;
      handlerSequence.push(handler);
    }

    // terminate chain
    return this;
  }
function(autocrat, governor, origHandler, context) {
    var streamsHash = this.streamsHash,
        handlerSequence, isFirstHandler, deferred, handler;

    context || (context = this.governor);

    if(isFunction(origHandler)) {
      origHandler = bind(origHandler, context);
    } else if(isString(origHandler)){
      origHandler = bind(this.governor[origHandler], context);
    }

    if(autocrat.awaiting[this.streamsHash]) {
      handlerSequence = autocrat.awaiting[this.streamsHash];
    } else {
      handlerSequence = autocrat.awaiting[this.streamsHash] = [];
      isFirstHandler = true;
    }

    deferred = new HandlerDeferred(handlerSequence);
    handler = this._buildAsyncHandler(origHandler, deferred);

    if(isFirstHandler) {
      deferred.handlerIndex = 0;
      handlerSequence.push(handler);
      this.resultStream.subscribe(handler);
    } else {
      deferred.handlerIndex = handlerSequence.length;
      handlerSequence.push(handler);
    }

    // terminate chain
    return this;
  }
function ( autocrat , governor , origHandler , context ) { var streamsHash = this . streamsHash , handlerSequence , isFirstHandler , deferred , handler ; context || ( context = this . governor ) ; if ( isFunction ( origHandler ) ) { origHandler = bind ( origHandler , context ) ; } else if ( isString ( origHandler ) ) { origHandler = bind ( this . governor [ origHandler ] , context ) ; } if ( autocrat . awaiting [ this . streamsHash ] ) { handlerSequence = autocrat . awaiting [ this . streamsHash ] ; } else { handlerSequence = autocrat . awaiting [ this . streamsHash ] = [ ] ; isFirstHandler = true ; } deferred = new HandlerDeferred ( handlerSequence ) ; handler = this . _buildAsyncHandler ( origHandler , deferred ) ; if ( isFirstHandler ) { deferred . handlerIndex = 0 ; handlerSequence . push ( handler ) ; this . resultStream . subscribe ( handler ) ; } else { deferred . handlerIndex = handlerSequence . length ; handlerSequence . push ( handler ) ; } // terminate chain return this ; }
Explicitly specify a side effect function

@function then
@name then
@instance
@memberof Law
Explicitly specify a side effect function