Introduction
Lifecycle of a Kuvio page.
Page
- beforeLoad
- Include any dependent script files (animation libraries, DOM helpers, etc. Is called before the DOM is loaded, so don't do anything DOM-related here.
- onLoad
- Initialize data; register events and listeners; DOM activities are useful here.
- unLoad
- Called when the page is exited. Usually you don't really need stuff here...
Module
Modules are useful if you're using a server side framework that works with partials. They can access the Page object (through KUVIO.structure.Page), but Page objects don't really have knowledge of the Modules. Modules can hook into Page events, but without a lot of hackery, Pages cannot hook into Module events. They have a similar life cycle to Page.
- onLoad
- If the page is already loaded, it will execute immediately. Otherwise it will wait until the page DOM is ready.
- unLoad
- Called when the module is removed from the page or the user exits the page.
Mixin
Mixins are similar to ASP.net server controls. They're self-contained JavaScript objects which deail primarily with the DOM. For example, an autocomplete dropdown list might be a Mixin.
- constructor
- Mixins need to be initialized from other modules or the page.
- All have basic events like onChange, onUpdate, etc. (documented when object is built out)