From 69ac0bd368dd73f49e0a01ef308285ed12da1717 Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 31 Jul 2015 15:50:47 +0100 Subject: [PATCH] Set up URL routing after creating matrixchat in case onload / hashchange gets called before --- examples/vector/index.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/vector/index.js b/examples/vector/index.js index b601cfce..64e517ca 100644 --- a/examples/vector/index.js +++ b/examples/vector/index.js @@ -49,15 +49,8 @@ function onHashChange(ev) { routeUrl(window.location); } -window.addEventListener('hashchange', onHashChange); - var loaded = false; -window.onload = function() { - routeUrl(window.location); - loaded = true; -} - // This will be called whenever the SDK changes screens, // so a web page can update the URL bar appropriately. var onNewScreen = function(screen) { @@ -81,3 +74,10 @@ window.matrixChat = React.render( , document.getElementById('matrixchat') ); + +window.addEventListener('hashchange', onHashChange); +window.onload = function() { + routeUrl(window.location); + loaded = true; +} +