Skip to content
Henrik Vendelbo edited this page Apr 30, 2014 · 7 revisions

The page body will have a stateful resolver tracking the state. You can define how the class should reflect the state. Have a look at Resolver("page::state::") to see the current values.

state true/false
livepage Is set 60ms after loading starts or when DOM onload is fired for quick pages.
loading Is set initially and cleared when all <link ..text/javascript.. > modules are loaded.
launching Is set when not loading, is configured, is connected, is authenticated, is authorised
launched Is not set automatically now, will be in the near future.

The authorised and connected requirement may be moved to launched in the future.

Reacting to state changes

You can listen to page state changes in general by,

Resolver("page::state").on("change",function(ev) {
    switch(ev.symbol) {
        case "loading": if (ev.value) ...
    }
});

Or you can listen very specifically,

Resolver("page::state.loading").on("false",startMyApp);
Resolver("page::state.livepage").on("false",stopMyApp);

Clone this wiki locally