src/index.js
function then (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function thenCallback (result) {
          callback(result);
          unbind('end', thenCallback);
        }

        bind('end', thenCallback);
        bind('stop', unbind.bind(null, 'end', thenCallback));

        return self;
      }
function then (callback) {
        if (typeof callback !== 'function') {
          throw new Error('Callback must be a function, instead got: ' + (typeof callback));
        }

        function thenCallback (result) {
          callback(result);
          unbind('end', thenCallback);
        }

        bind('end', thenCallback);
        bind('stop', unbind.bind(null, 'end', thenCallback));

        return self;
      }
function then ( callback ) { if ( typeof callback !== 'function' ) { throw new Error ( 'Callback must be a function, instead got: ' + ( typeof callback ) ) ; } function thenCallback ( result ) { callback ( result ) ; unbind ( 'end' , thenCallback ) ; } bind ( 'end' , thenCallback ) ; bind ( 'stop' , unbind . bind ( null , 'end' , thenCallback ) ) ; return self ; }
Run on complete and automatically unbind
Run on complete and automatically unbind