lib/eventstore.js
function (callback) {
    var self = this;

    function initDispatcher() {
      debug('init event dispatcher');
      self.dispatcher = new EventDispatcher(self.publisher, self);
      self.dispatcher.start(callback);
    }

    this.store.on('connect', function () {
      self.emit('connect');
    });

    this.store.on('disconnect', function () {
      self.emit('disconnect');
    });

    process.nextTick(function() {
      tolerate(function(callback) {
        self.store.connect(callback);
      }, self.options.timeout || 0, function (err) {
        if (err) {
          debug(err);
          if (callback) callback(err);
          return;
        }
        if (!self.publisher) {
          debug('no publisher defined');
          if (callback) callback(null);
          return;
        }
        initDispatcher();
      });
    });
  }
function (callback) {
    var self = this;

    function initDispatcher() {
      debug('init event dispatcher');
      self.dispatcher = new EventDispatcher(self.publisher, self);
      self.dispatcher.start(callback);
    }

    this.store.on('connect', function () {
      self.emit('connect');
    });

    this.store.on('disconnect', function () {
      self.emit('disconnect');
    });

    process.nextTick(function() {
      tolerate(function(callback) {
        self.store.connect(callback);
      }, self.options.timeout || 0, function (err) {
        if (err) {
          debug(err);
          if (callback) callback(err);
          return;
        }
        if (!self.publisher) {
          debug('no publisher defined');
          if (callback) callback(null);
          return;
        }
        initDispatcher();
      });
    });
  }
function ( callback ) { var self = this ; function initDispatcher ( ) { debug ( 'init event dispatcher' ) ; self . dispatcher = new EventDispatcher ( self . publisher , self ) ; self . dispatcher . start ( callback ) ; } this . store . on ( 'connect' , function ( ) { self . emit ( 'connect' ) ; } ) ; this . store . on ( 'disconnect' , function ( ) { self . emit ( 'disconnect' ) ; } ) ; process . nextTick ( function ( ) { tolerate ( function ( callback ) { self . store . connect ( callback ) ; } , self . options . timeout || 0 , function ( err ) { if ( err ) { debug ( err ) ; if ( callback ) callback ( err ) ; return ; } if ( ! self . publisher ) { debug ( 'no publisher defined' ) ; if ( callback ) callback ( null ) ; return ; } initDispatcher ( ) ; } ) ; } ) ; }
Call this function to initialize the eventstore.
If an event publisher function was injected it will additionally initialize an event dispatcher.
@param {Function} callback the function that will be called when this action has finished [optional]
Call this function to initialize the eventstore . If an event publisher function was injected it will additionally initialize an event dispatcher .