From 69b36232739a4abea856be2f9c98579801e5e929 Mon Sep 17 00:00:00 2001 From: Yiyi Sun Date: Tue, 5 Mar 2019 10:56:08 -0500 Subject: [PATCH] not to link onpopstate if app['route'] is not the default one --- src/apprun.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/apprun.ts b/src/apprun.ts index bd18a4cc..f060371d 100644 --- a/src/apprun.ts +++ b/src/apprun.ts @@ -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); + } }); }