About Pi Downloads Documentation Plugins Developer Forum Issues

pi.util.Init

Summary

An array containing functions that runs when DOM document is loaded.

Syntax

pi.util.Init.push(function);

Usage Example

>>> pi.util.Init
[]
>>> pi.util.Init.push(function(){
	alert("Hello World");
});

Examples

Example #1: Print a message when document is ready.

Source files of the above example:

../../examples/onload.html

<div id="messageContainer">
</div>

../../examples/onload.js

pi.get("messageContainer").innerHTML="Hello World";