index.js
function(initState) {

    if(!this.isInitialized) {
      this.isInitialized = true;

      var driver = this.driver;

      if(!this.defStates) {

        throw new Error('You must define states before attempting to call init');
      } else if(!this.defTransitions) {

        throw new Error('You must define transitions before attempting to call init');
      } else if(!this.parser) {

        throw new Error('You must define parsers before attempting to call init');
      } else if(!this.defTargets) {

        throw new Error('You must define targets before attempting to call init');
      } else {

        parseStates(driver, this.defStates);
        parseTransitions(driver, this.defStates, this.defTransitions);

        this.parser.init(this.defStates, this.defTargets, this.defTransitions);

        driver.init(initState);
      }

      if(global.__f1__) {
        global.__f1__.init(this);
      } 
    }

    return this;
  }
function(initState) {

    if(!this.isInitialized) {
      this.isInitialized = true;

      var driver = this.driver;

      if(!this.defStates) {

        throw new Error('You must define states before attempting to call init');
      } else if(!this.defTransitions) {

        throw new Error('You must define transitions before attempting to call init');
      } else if(!this.parser) {

        throw new Error('You must define parsers before attempting to call init');
      } else if(!this.defTargets) {

        throw new Error('You must define targets before attempting to call init');
      } else {

        parseStates(driver, this.defStates);
        parseTransitions(driver, this.defStates, this.defTransitions);

        this.parser.init(this.defStates, this.defTargets, this.defTransitions);

        driver.init(initState);
      }

      if(global.__f1__) {
        global.__f1__.init(this);
      } 
    }

    return this;
  }
function ( initState ) { if ( ! this . isInitialized ) { this . isInitialized = true ; var driver = this . driver ; if ( ! this . defStates ) { throw new Error ( 'You must define states before attempting to call init' ) ; } else if ( ! this . defTransitions ) { throw new Error ( 'You must define transitions before attempting to call init' ) ; } else if ( ! this . parser ) { throw new Error ( 'You must define parsers before attempting to call init' ) ; } else if ( ! this . defTargets ) { throw new Error ( 'You must define targets before attempting to call init' ) ; } else { parseStates ( driver , this . defStates ) ; parseTransitions ( driver , this . defStates , this . defTransitions ) ; this . parser . init ( this . defStates , this . defTargets , this . defTransitions ) ; driver . init ( initState ) ; } if ( global . __f1__ ) { global . __f1__ . init ( this ) ; } } return this ; }
Initializes `f1`. `init` will throw errors if required parameters such as
states and transitions are missing. The initial state for the `f1` instance
should be passed in.

@param  {String} Initial state for the `f1` instance
@chainable
Initializes f1 . init will throw errors if required parameters such as states and transitions are missing . The initial state for the f1 instance should be passed in .