Relocate setting page base to app initialization

Previously the page base was set on router load time. This meant that
a base url needed to be set before the router code was evaluated by
the browser. Now the router javascript can run and the base url will
be set when the router is initialized instead of when the router code
is initially executed. This small timing tweak allows for the
polygerrit code to be loaded into the browser and change the base url
before starting the polygerrit-ui.

Change-Id: Ie89b5491877b7ab4ef285cba3babc4ee0c9087f9
(cherry picked from commit 44478c039c)
This commit is contained in:
Thomas Shafer
2017-04-24 09:20:47 -07:00
committed by Paladox none
parent dcb4bd544c
commit 6b8b355da9

View File

@@ -33,16 +33,16 @@
getReporting().pageLoaded();
};
var base = window.Gerrit.BaseUrlBehavior.getBaseUrl();
if (base) {
page.base(base);
}
window.addEventListener('WebComponentsReady', function() {
getReporting().timeEnd('WebComponentsReady');
});
function startRouter() {
var base = window.Gerrit.BaseUrlBehavior.getBaseUrl();
if (base) {
page.base(base);
}
var restAPI = document.createElement('gr-rest-api-interface');
var reporting = getReporting();