My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
Detail_Global_Object  
live's global umbrella object
Detail, GlobalObject
Updated Oct 13, 2011 by felk...@gmail.com

This details the live global object and assumes you have read the Getting Started Page.

What is the global object?

live is a global, self-contained umbrella object. Specifically, it:

  • is the first object instantiated at library runtime
  • is the main interface between the library and the developer
  • maintains currently active UI components
  • a library component of it own with utility functions

Instantiating the Global Object

live is instantiated in the head of the web document by explicitly assigning it as a property of the window object. As with any library component, live can be passed a configuration object. Currently, live has two configurable properties, live.page and live.browser. More on these below.

    window.live = new live();

Once the global object has been defined, it begins it's configuration routine . Here we will see live assign many of it's key properties. In order these will be:

Property Type Description Default
page Config object Used for page details window.location
browser Config object Contains browser details Prototype.Browser
rollovers Hash object Collects rollover UI compontnets empty $H()
popups Hash object Collects popup UI compontnets empty $H()
dropdowns Hash object Collects dropdown menu UI compontnets empty $H()
tooltips Hash object Collects tooltip UI compontnets empty $H()
forms Hash object Collects from UI compontnets empty $H()
regex Hash object Regular expressions utility object Pre-defined regular expressions

Once all of these properties have been defined, the global object observes the document object and waits for the DOM to become accessible. At that point, live calls two functions, init_dom() and init_ui()

The DOM interface, init_dom()

This functions assigns core DOM elements references to the global object as properties. These DOM reference properties will be used for subsequent functions and libraries. These include:

html The root element of the web document
head The head element of the web document
body The body element of the web document

Example of Use

   live.body.setStyle('background:#F00BAA');

The UI interface, init_ui()

live Properties

  • body - Extended DOM assignment of the body element
  • browser - Browser information
  • canopy - Instantiated Canopy library object
  • config - Configuration
  • dropdowns - Hash object of all instantiated dropdowns
  • head - Extended DOM assignment of the head element
  • html - Extended DOM assignment of the html element
  • keys - Instantiated KeyCode library object
  • modal - Instantiated Modal library object
  • mouse - X/Y coordinates of mouse
  • page - Details about the page
  • popups - Hash object of all instantiated popups
  • rollovers - Hash object of all instantiated rollovers
  • tooltips - Hash object of all instantiated tooltips
  • viewport - Width / height details of document.viewport
  • viewport_offset - Offset details of document.viewport

live's Functions

live.get_viewport_dimensions();

Stores the height and width of the viewport. Called on the window resize event, live sets numerical values for live.viewport.height and live.viewport.width

live.get_body_dimensions()

Like get_viewport_dimensions(), but stores the height and width of the body element Called on the window resize event,live sets numerical values for live.body.height and live.body.width

live.create_js('myjsfile.js')

Creates a script element with the supplied src and appends it to the head of the document.

live.create_css('mycssfile.css')

Creates a css link element with the supplied href and appends it to the head of the document

live.print_page('http://nyan.cat') //src param is optional

Prints a page. If the src attribute is passed, it creates a iframe and prints the iframe when it's loaded. If no src is passed, it will print the current page.

Powered by Google Project Hosting