examples/npm/output.js
function(fragment, triggerRoute) {
      var frag = (fragment || '').replace(hashStrip, '');
      if (this.fragment == frag || this.fragment == decodeURIComponent(frag)) return;
      if (this._hasPushState) {
        var loc = window.location;
        if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag;
        this.fragment = frag;
        window.history.pushState({}, document.title, loc.protocol + '//' + loc.host + frag);
      } else {
        window.location.hash = this.fragment = frag;
        if (this.iframe && (frag != this.getFragment(this.iframe.location.hash))) {
          this.iframe.document.open().close();
          this.iframe.location.hash = frag;
        }
      }
      if (triggerRoute) this.loadUrl(fragment);
    }
function(fragment, triggerRoute) {
      var frag = (fragment || '').replace(hashStrip, '');
      if (this.fragment == frag || this.fragment == decodeURIComponent(frag)) return;
      if (this._hasPushState) {
        var loc = window.location;
        if (frag.indexOf(this.options.root) != 0) frag = this.options.root + frag;
        this.fragment = frag;
        window.history.pushState({}, document.title, loc.protocol + '//' + loc.host + frag);
      } else {
        window.location.hash = this.fragment = frag;
        if (this.iframe && (frag != this.getFragment(this.iframe.location.hash))) {
          this.iframe.document.open().close();
          this.iframe.location.hash = frag;
        }
      }
      if (triggerRoute) this.loadUrl(fragment);
    }
function ( fragment , triggerRoute ) { var frag = ( fragment || '' ) . replace ( hashStrip , '' ) ; if ( this . fragment == frag || this . fragment == decodeURIComponent ( frag ) ) return ; if ( this . _hasPushState ) { var loc = window . location ; if ( frag . indexOf ( this . options . root ) != 0 ) frag = this . options . root + frag ; this . fragment = frag ; window . history . pushState ( { } , document . title , loc . protocol + '//' + loc . host + frag ) ; } else { window . location . hash = this . fragment = frag ; if ( this . iframe && ( frag != this . getFragment ( this . iframe . location . hash ) ) ) { this . iframe . document . open ( ) . close ( ) ; this . iframe . location . hash = frag ; } } if ( triggerRoute ) this . loadUrl ( fragment ) ; }
Save a fragment into the hash history. You are responsible for properly URL-encoding the fragment in advance. This does not trigger a `hashchange` event.
Save a fragment into the hash history . You are responsible for properly URL - encoding the fragment in advance . This does not trigger a hashchange event .