Skip to content

Commit 5a7998a

Browse files
Johannes Steinryanflorence
authored andcommitted
Bind Router.handleLocationChange to Router
In any other case, Router.dispatch does not know what its context is
1 parent dfdddff commit 5a7998a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/createRouter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ function createRouter(options) {
423423

424424
if (!(location instanceof StaticLocation)) {
425425
if (location.addChangeListener)
426-
location.addChangeListener(Router.handleLocationChange);
426+
location.addChangeListener(Router.handleLocationChange.bind(Router));
427427

428428
this.isRunning = true;
429429
}
@@ -440,7 +440,7 @@ function createRouter(options) {
440440
this.cancelPendingTransition();
441441

442442
if (location.removeChangeListener)
443-
location.removeChangeListener(Router.handleLocationChange);
443+
location.removeChangeListener(Router.handleLocationChange.bind(Router));
444444

445445
this.isRunning = false;
446446
},

0 commit comments

Comments
 (0)