summaryrefslogtreecommitdiffstats
path: root/WebContent/VAADIN/vaadinBootstrap.js
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2011-11-28 13:42:02 +0200
committerLeif Åstrand <leif@vaadin.com>2011-11-28 13:42:02 +0200
commit6063d00f5ae6f0cb5c5eaf0c3ce2998c5aa88a2b (patch)
tree218c6fb4f62f20325d25aeed94b38338b7708f33 /WebContent/VAADIN/vaadinBootstrap.js
parentcb5f080e5337c081f22eea86c0cf170ef88a2257 (diff)
downloadvaadin-framework-6063d00f5ae6f0cb5c5eaf0c3ce2998c5aa88a2b.tar.gz
vaadin-framework-6063d00f5ae6f0cb5c5eaf0c3ce2998c5aa88a2b.zip
Add support for deferred Root init and early widgetset loading
Diffstat (limited to 'WebContent/VAADIN/vaadinBootstrap.js')
-rw-r--r--WebContent/VAADIN/vaadinBootstrap.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/WebContent/VAADIN/vaadinBootstrap.js b/WebContent/VAADIN/vaadinBootstrap.js
index cc9829b6e4..61783c448e 100644
--- a/WebContent/VAADIN/vaadinBootstrap.js
+++ b/WebContent/VAADIN/vaadinBootstrap.js
@@ -12,8 +12,8 @@
}
var loadTheme = function(url) {
- log("loadTheme", url);
if(!themesLoaded[url]) {
+ log("loadTheme", url);
var stylesheet = document.createElement('link');
stylesheet.setAttribute('rel', 'stylesheet');
stylesheet.setAttribute('type', 'text/css');
@@ -86,9 +86,9 @@
var r = new XMLHttpRequest();
r.open('POST', url, true);
r.onreadystatechange = function (aEvt) {
- if (r.readyState == 4) {
+ if (r.readyState == 4) {
if (r.status == 200){
- log(r.responseText);
+ log("Got root config response", r.responseText);
// TODO Does this work in all supported browsers?
var updatedConfig = JSON.parse(r.responseText);
@@ -98,6 +98,7 @@
config[property] = updatedConfig[property];
}
}
+ config.initPending = false;
// Try bootstrapping again, this time without fetching missing info
bootstrapApp(false);
@@ -125,19 +126,25 @@
var widgetsetBase = getConfig('widgetsetBase');
var widgetset = getConfig('widgetset');
+ var initPending = getConfig('initPending');
if (widgetset && widgetsetBase) {
loadWidgetset(widgetsetBase, widgetset);
+ }
+
+ if (initPending) {
+ if (mayDefer) {
+ fetchRootConfig();
+ } else {
+ throw "May not defer bootstrap any more";
+ }
+ } else {
if (widgetsets[widgetset].callback) {
log("Starting from bootstrap", appId);
widgetsets[widgetset].callback(appId);
} else {
- log("Setting pending startup of ", appId);
+ log("Setting pending startup", appId);
widgetsets[widgetset].pendingApps.push(appId);
}
- } else if (mayDefer) {
- fetchRootConfig();
- } else {
- throw "Widgetset not defined: " + widgetsetBase + " -> " + widgetset;
}
}
bootstrapApp(true);