Move all code that executes after the switches to a new function

If any switches are async, the subsequent code will execute before
the switches are finished. This commit moves all that code to a new
function, and debounces the calls to onSwitch() so it only executes
once, after all the switches finish.

Fizes #72.
This commit is contained in:
Behind The Math
2018-01-20 22:06:03 -05:00
parent ca61c4a840
commit cb0a7cd850
3 changed files with 77 additions and 51 deletions

View File

@@ -9,7 +9,8 @@ tape("test switchesSelectors", function(t) {
var pjax = {
onSwitch: function() {
console.log("Switched")
}
},
state: {}
}
var tmpEl = document.implementation.createHTMLDocument()