Created
July 6, 2016 13:07
-
-
Save sdougbrown/16e0a61febae13793fcb99ed865c5e26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var CHECK_INTERVAL = 100; | |
var CURRENT_PATH = window.location.pathname; | |
var PREVIOUS_PATH = ""; | |
function checkPath () { | |
if (CURRENT_PATH !== window.location.pathname) { | |
PREVIOUS_PATH = CURRENT_PATH; | |
CURRENT_PATH = window.location.pathname; | |
$(window.location).trigger("change", { | |
currentPath: CURRENT_PATH, | |
previousPath: PREVIOUS_PATH | |
}); | |
} | |
} | |
// poll for location changes | |
setInterval(checkPath, CHECK_INTERVAL); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment