aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/index.umd.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant/src/index.umd.ts')
-rw-r--r--packages/instant/src/index.umd.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index 869b52353..3d7774858 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -89,11 +89,10 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
// If the integrator defined a popstate handler, save it to __zeroExInstantIntegratorsPopStateHandler
// unless we have already done so on a previous render.
const anyWindow = window as any;
- if (window.onpopstate && !anyWindow.__zeroExInstantIntegratorsPopStateHandler) {
- anyWindow.__zeroExInstantIntegratorsPopStateHandler = window.onpopstate.bind(window);
- } else {
- anyWindow.__zeroExInstantIntegratorsPopStateHandler = util.boundNoop;
- }
+ const popStateExistsAndNotSetPreviously = window.onpopstate && !anyWindow.__zeroExInstantIntegratorsPopStateHandler;
+ anyWindow.__zeroExInstantIntegratorsPopStateHandler = popStateExistsAndNotSetPreviously
+ ? anyWindow.onpopstate.bind(window)
+ : util.boundNoop;
const onPopStateHandler = (e: PopStateEvent) => {
anyWindow.__zeroExInstantIntegratorsPopStateHandler(e);
const newState = e.state;