|
Detail_Global_Object
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:
Instantiating the Global Objectlive 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:
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:
Example of Use live.body.setStyle('background:#F00BAA');The UI interface, init_ui()live Properties
live's Functionslive.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 optionalPrints 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. | ||||||||||||||||||||||||||||||||||||||||||