module.exports = function (path) {
  return {
    path: path || '',

    getURL: function () {
      return this.path
    },

    setURL: function (path) {
      this.path = path
      this.handleURL(this.getURL())
    },

    replaceURL: function (path) {
      this.setURL(path)
    },

    onChange: function (callback) {
      this.changeCallback = callback
    },

    handleURL: function (url) {
      this.path = url
      if (this.changeCallback) {
        this.changeCallback(url)
      }
    },

    usesPushState: function () {
      return false
    },

    removeRoot: function (url) {
      return url
    },

    formatURL: function (url) {
      return url
    }
  }
}

var _ = require('../dash')

module.exports = function (path) {
  return {
    path: path || '',

    getURL: function () {
      return this.path
    },

    setURL: function (path, options) {
      if (this.path !== path) {
        this.path = path
        this.handleURL(this.getURL(), options)
      }
    },

    replaceURL: function (path, options) {
      if (this.path !== path) {
        this.setURL(path, options)
      }
    },

    onChange: function (callback) {
      this.changeCallback = callback
    },

    handleURL: function (url, options) {
      this.path = url
      options = _.extend({trigger: true}, options)
      if (this.changeCallback && options.trigger) {
        this.changeCallback(url)
      }
    },

    usesPushState: function () {
      return false
    },

    removeRoot: function (url) {
      return url
    },

    formatURL: function (url) {
      return url
    }
  }
}

Make MemoryLocation more useful for the server side rendering
Make MemoryLocation more useful for the server side rendering

Make locations/memory behave a more like history, respect the
trigger: false option which is important when cancelling transitions,
otherwise a redirect loop is caused since after transitions are cancelled
the url in the location is reset using replaceURL

Also - check if path changed before updating it
