Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / src / observable / OneRouterStore.ts
Size: Mime:
import { observable, action } from 'xmobx/mobx'

export class RouterStore {
  constructor() {
    this.location = observable(undefined)
    this.history = observable(undefined)
  }

  @action
  _updateLocation(newState) {
    this.location = newState
  }

  /**
   * --------------
   * history methods
   */
  push = location => {
    this.history.push(location)
  }
  replace = location => {
    this.history.replace(location)
  }
  go = route => {
    this.history.go(route)
  }
  goBack = () => {
    this.history.goBack()
  }
  goForward = () => {
    this.history.goForward()
  }
}