Namespace o2
namespace
o2
A static class for making AJAX GET and POST requests.
A class to modify collections.
A cookie helper class.
A date/time utilities class.
A static object for debugging purposes.
Usage example:
// note: initalize Debugger only once, // possibly on window.load or dom content ready o2.Debugger.init(someDomNode, true); //then inside your code use this syntax. o2.Debugger.println('stuff to debug');
A cross-browser event handling and event utilities class.
An object to make JSONP calls.
A method helper class.
A helper class for JavaScript Object
inheritance.
Used for parsing the browser's query string.
Custom delegates for Array.sort
method.
A String
helper class.
Checks support for various objects and properties like DOM and cookies.
A really fast template engine.
A class for executing repeated timed actions.
Usage example:
// A unique id for the timer. var kCheckId = 'my_timer'; // Auto start timer with id kCheckId to repeat doStuff approximately // every 500 milliseconds, please note that this is an approximation. // for further details see John Resig's excellent article on this: // http://ejohn.org/blog/how-javascript-timers-work/ o2.Timer.set(kCheckId, doStuff, 500, {start: true, repeat: true}); // Stops the timer (i.e. doStuff will not be executed further). o2.Timer.stop(kCheckId); // Restarts the timer (i.e. doStuff will be periodically executed again). o2.Timer.start(kCheckId);
Used for consequentially executing a set of
Function
s.
The functions are guaranteed to be called.
Even if an error occurs when calling a Function
, the next
Function
will be tried, disregarding the error.
A "unit test" runner.
Runs UnitTest
s.
A simple class for validating various kinds of objects.
Project build number.
Full name of the project.
Short name of the framework, to be used in prefixes, class names etc.
URL of the project.
Project version.
An alias for document.getElementById
.
Usage example:
var domRef = o2.$('elementId');
An alias for Event.addEventListener(window, 'load',
callback)
.
Usage example:
o2.load(function() { initializeWidget(); });
A getElementsByName
wrapper.
Usage example:
var allTags = o2.n('username', 'testForm');
An empty function.
Acts similar to {link o2.n} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.nn('userprefs', 'testForm');
Exports the o2 namespace under a new name, so that it can be used together with an older version of o2.js
Usage example:
[script type="text/javascript" charset="UTF-8" src="o2.0.21.js"][/script] [script type="text/javascript" charset="UTF-8"] // Now "o2 v.0.21" can be accessed through o3 variable // (or window.o3). o2.noConflict('o3'); // Alternative usage without giving explicit namespace. myApp.o2 = o2.noConflict(); [/script] [script type="text/javascript" charset="UTF-8" src="o2.0.23.js"][/script]
Returns the unix time (i.e. the number of milliseconds since midnight of January 1, 1970)
Usage example:
var unixTimestamp = o2.now();
An alias for Dom.ready
.
Usage example:
o2.ready(function() { initializeWidget(); });
A getElementsByTagName
wrapper.
Usage example:
var allNodes = o2.t('*')
Property Details
property readonly String build
Project build number.
property readonly String longName
Full name of the project.
property readonly String name
Short name of the framework, to be used in prefixes, class names etc.
property readonly String url
URL of the project.
property readonly String version
Project version.
Function Details
function $
static
$(Object
obj)
An alias for document.getElementById
.
Usage example:
var domRef = o2.$('elementId');
obj
- the id to check. String
;
obj itself otherwise.
undefined
.function load
static
load(Function
callback)
An alias for Event.addEventListener(window, 'load',
callback)
.
Usage example:
o2.load(function() { initializeWidget(); });
callback
- The callback to execute when window is
loaded. function n
static
n(String
tagName, DOMNode
parent)
A getElementsByName
wrapper.
Usage example:
var allTags = o2.n('username', 'testForm');
tagName
- the name of the form item to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. function nill
static
nill()
An empty function.
function nn
static
nn(String
name, DOMNode
parent)
Acts similar to {link o2.n} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.nn('userprefs', 'testForm');
name
- the name of the element to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. null
otherwise.
function noConflict
static
noConflict(String
newName)
Exports the o2 namespace under a new name, so that it can be used together with an older version of o2.js
Usage example:
[script type="text/javascript" charset="UTF-8" src="o2.0.21.js"][/script] [script type="text/javascript" charset="UTF-8"] // Now "o2 v.0.21" can be accessed through o3 variable // (or window.o3). o2.noConflict('o3'); // Alternative usage without giving explicit namespace. myApp.o2 = o2.noConflict(); [/script] [script type="text/javascript" charset="UTF-8" src="o2.0.23.js"][/script]
newName
- (Optional; a random unique namespace will be
created if not given) the name of the new namespace. Object
.
function now
static
now()
Returns the unix time (i.e. the number of milliseconds since midnight of January 1, 1970)
Usage example:
var unixTimestamp = o2.now();
function ready
static
ready(Function
callback)
An alias for Dom.ready
.
Usage example:
o2.ready(function() { initializeWidget(); });
callback
- The callback to execute when DOM is
ready. function t
static
t(String
tagName, DOMNode
parent)
A getElementsByTagName
wrapper.
Usage example:
var allNodes = o2.t('*')
tagName
- the name of the tag to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. function tt
static
tt(String
tagName, DOMNode
parent)
Acts similar to {link o2.t} -- with one exception: The method returns the first matched node, instead of returning a node collection.
Usage example:
var firstDiv = o2.tt('div', 'MasterContainer');
tagName
- the name of the tag to search.
parent
- (optional defaults to document
)
the parent container, or the id of the parent container, to search. null
otherwise.