history.js
function onHashChange(event) {
    // https://github.com/devote/HTML5-History-API/issues/46
    var fireNow = lastURL;
    // new value to lastURL
    lastURL = windowLocation.href;
    // if not empty fireNow, otherwise skipped the current handler event
    if (fireNow) {
      // if checkUrlForPopState equal current url, this means that the event was raised popstate browser
      if (checkUrlForPopState !== windowLocation.href) {
        // otherwise,
        // the browser does not support popstate event or just does not run the event by changing the hash.
        firePopState();
      }
      // current event object
      event = event || global.event;

      var oldURLObject = parseURL(fireNow, true);
      var newURLObject = parseURL();
      // HTML4 browser not support properties oldURL/newURL
      if (!event.oldURL) {
        event.oldURL = oldURLObject._href;
        event.newURL = newURLObject._href;
      }
      if (oldURLObject._hash !== newURLObject._hash) {
        // if current hash not equal previous hash
        dispatchEvent(event);
      }
    }
  }
function onHashChange(event) {
    // https://github.com/devote/HTML5-History-API/issues/46
    var fireNow = lastURL;
    // new value to lastURL
    lastURL = windowLocation.href;
    // if not empty fireNow, otherwise skipped the current handler event
    if (fireNow) {
      // if checkUrlForPopState equal current url, this means that the event was raised popstate browser
      if (checkUrlForPopState !== windowLocation.href) {
        // otherwise,
        // the browser does not support popstate event or just does not run the event by changing the hash.
        firePopState();
      }
      // current event object
      event = event || global.event;

      var oldURLObject = parseURL(fireNow, true);
      var newURLObject = parseURL();
      // HTML4 browser not support properties oldURL/newURL
      if (!event.oldURL) {
        event.oldURL = oldURLObject._href;
        event.newURL = newURLObject._href;
      }
      if (oldURLObject._hash !== newURLObject._hash) {
        // if current hash not equal previous hash
        dispatchEvent(event);
      }
    }
  }
function onHashChange ( event ) { // https://github.com/devote/HTML5-History-API/issues/46 var fireNow = lastURL ; // new value to lastURL lastURL = windowLocation . href ; // if not empty fireNow, otherwise skipped the current handler event if ( fireNow ) { // if checkUrlForPopState equal current url, this means that the event was raised popstate browser if ( checkUrlForPopState !== windowLocation . href ) { // otherwise, // the browser does not support popstate event or just does not run the event by changing the hash. firePopState ( ) ; } // current event object event = event || global . event ; var oldURLObject = parseURL ( fireNow , true ) ; var newURLObject = parseURL ( ) ; // HTML4 browser not support properties oldURL/newURL if ( ! event . oldURL ) { event . oldURL = oldURLObject . _href ; event . newURL = newURLObject . _href ; } if ( oldURLObject . _hash !== newURLObject . _hash ) { // if current hash not equal previous hash dispatchEvent ( event ) ; } } }
Event handler function changes the hash in the address bar

@param {Event} event
@return void
Event handler function changes the hash in the address bar