Skip to content

Commit

Permalink
not to link onpopstate if app['route'] is not the default one
Browse files Browse the repository at this point in the history
  • Loading branch information
yysun committed Mar 5, 2019
1 parent c4ecd71 commit 69b3623
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/apprun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ app.on('route', url => app['route'] && app['route'](url));

if (typeof document === 'object') {
document.addEventListener("DOMContentLoaded", () => {
window.onpopstate = () => app['route'] && app['route'](location.hash);
app['route'] && app['route'](location.hash);
if (app['route'] === route) {
window.onpopstate = () => route(location.hash);
route(location.hash);
}
});
}

Expand Down

0 comments on commit 69b3623

Please sign in to comment.