nl_tokens: A client - side router for stateful - controller using the history API @module stateful - controller - browser - router @author Joris van der Wel <joris@jorisvanderwel . com > Construct a new router
pl_tokens: function Router ( window , urlStateMap , frontController ) { EventEmitter . call ( this ) ; this . window = window ; this . urlStateMap = urlStateMap ; this . frontController = frontController ; this . currentStateList = null ; this . _pendingTransitionPromise = null ; this . _pendingReplace = null ; this . _initialHistoryState = null ; this . _queue = { hasEntry : false , stateList : null , fromHistory : false , upgrade : false , push : <mask> , promise : null , resolve : null , reject : null } ; if ( ! window || ! urlStateMap || ! frontController ) { throw Error ( 'Missing argument' ) ; } if ( typeof this . urlStateMap . toURL !== 'function' || typeof this . urlStateMap . fromURL !== 'function' ) { throw Error ( 'Argument `urlStateMap` must implement toURL(states) and fromURL(url)' ) ; } if ( ! Router . isSupported ( this . window ) ) { throw Error ( 'Argument `window` does not support the history API' ) ; } if ( this . frontController . isStatefulController1 !== true ) { throw Error ( 'Argument `frontController` is not a stateful-controller' ) ; } this . _onpopstate = this . _onpopstate . bind ( this ) ; }