Skip to content

Page Launching Control

thepian edited this page Sep 9, 2012 · 7 revisions

By default the web page will load javascript without any special instructions. You can however change it to depend on deferred scripts, config, login and user properties.

The page resolver tracks the state and configuration of the page. It is used to decorate the body element so the page can be styled based on the current state.

By default the state is authenticated, authorised, connected, configured. Since these are set by default the page will be launched without waiting.

Launch when logged in

If the page connects to a backend for authentication and authorisation and you want to delay the page launching until the connection is established you will need to prevent the default and trigger the launching yourself.

Put the following in your html:

<script>
 Resolver("page").set("state.authenticated",false);
 Resolver("page").on("change","state.loading",function(ev) { 
   if (ev.value == false) ev.preventDefault();
 });
</script>

And then when the connection is established

Resolver("page").set("state.authenticated",true)

Adding a configuration processing step

And then when the loaded scripts and configuration is applied

Resolver("page").set("state.configured",true)

Delayed loading of scripts

Delayed loading of config

Responding to online/offline status

Clone this wiki locally