forked from matrix/element-web
Set up URL routing after creating matrixchat in case onload / hashchange gets called before
This commit is contained in:
parent
9f98c4e9f7
commit
69ac0bd368
|
@ -49,15 +49,8 @@ function onHashChange(ev) {
|
||||||
routeUrl(window.location);
|
routeUrl(window.location);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('hashchange', onHashChange);
|
|
||||||
|
|
||||||
var loaded = false;
|
var loaded = false;
|
||||||
|
|
||||||
window.onload = function() {
|
|
||||||
routeUrl(window.location);
|
|
||||||
loaded = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This will be called whenever the SDK changes screens,
|
// This will be called whenever the SDK changes screens,
|
||||||
// so a web page can update the URL bar appropriately.
|
// so a web page can update the URL bar appropriately.
|
||||||
var onNewScreen = function(screen) {
|
var onNewScreen = function(screen) {
|
||||||
|
@ -81,3 +74,10 @@ window.matrixChat = React.render(
|
||||||
<MatrixReactSdk.MatrixChat onNewScreen={onNewScreen} registrationUrl={makeRegistrationUrl()} />,
|
<MatrixReactSdk.MatrixChat onNewScreen={onNewScreen} registrationUrl={makeRegistrationUrl()} />,
|
||||||
document.getElementById('matrixchat')
|
document.getElementById('matrixchat')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
window.addEventListener('hashchange', onHashChange);
|
||||||
|
window.onload = function() {
|
||||||
|
routeUrl(window.location);
|
||||||
|
loaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue