make setPath always async
This commit is contained in:
parent
520d15a060
commit
e8e0bae726
10 changed files with 154 additions and 61 deletions
|
|
@ -5,6 +5,7 @@ var parseQueryString = require("../querystring/parse")
|
|||
|
||||
module.exports = function($window) {
|
||||
var supportsPushState = typeof $window.history.pushState === "function" && $window.location.protocol !== "file:"
|
||||
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
||||
|
||||
var prefix = "#!"
|
||||
function setPrefix(value) {prefix = value}
|
||||
|
|
@ -60,7 +61,7 @@ module.exports = function($window) {
|
|||
if (supportsPushState) {
|
||||
if (options && options.replace) $window.history.replaceState(null, null, prefix + path)
|
||||
else $window.history.pushState(null, null, prefix + path)
|
||||
$window.onpopstate()
|
||||
callAsync($window.onpopstate)
|
||||
}
|
||||
else $window.location.href = prefix + path
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue