Fix async switches (#110)

If any switches are async, the subsequent code will execute before the switches are finished. This PR 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 was merged in pull request #110.
This commit is contained in:
BehindTheMath
2018-01-22 10:55:29 -05:00
committed by GitHub
parent ca61c4a840
commit b5c2120d08
5 changed files with 92 additions and 58 deletions

View File

@@ -38,7 +38,7 @@
"lint": "jscs . && jshint . --exclude-path .gitignore",
"standalone": "browserify index.js --standalone Pjax > pjax.js",
"build-debug": "browserify index.js --debug --standalone Pjax > pjax.js",
"tests": "tape -r ./tests/index.js ./tests/**/*.js",
"tests": "tape -r ./tests/setup.js ./tests/**/*.js",
"test": "npm run lint && npm run tests | tap-spec",
"coverage-tests": "npm run tests | tap-nyc",
"coverage": "nyc -x \"tests/**\" npm run coverage-tests",