Skip to content

Commit 69ac0bd

Browse files
committed
Set up URL routing after creating matrixchat in case onload / hashchange gets called before
1 parent 9f98c4e commit 69ac0bd

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎examples/vector/index.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,8 @@ function onHashChange(ev) {
4949
routeUrl(window.location);
5050
}
5151

52-
window.addEventListener('hashchange', onHashChange);
53-
5452
var loaded = false;
5553

56-
window.onload = function() {
57-
routeUrl(window.location);
58-
loaded = true;
59-
}
60-
6154
// This will be called whenever the SDK changes screens,
6255
// so a web page can update the URL bar appropriately.
6356
var onNewScreen = function(screen) {
@@ -81,3 +74,10 @@ window.matrixChat = React.render(
8174
<MatrixReactSdk.MatrixChat onNewScreen={onNewScreen} registrationUrl={makeRegistrationUrl()} />,
8275
document.getElementById('matrixchat')
8376
);
77+
78+
window.addEventListener('hashchange', onHashChange);
79+
window.onload = function() {
80+
routeUrl(window.location);
81+
loaded = true;
82+
}
83+

0 commit comments

Comments
 (0)