CrxOop provides utility functions to help in developing with it. These utility functions are not to be confused with general utility functions that can be replaced wih similar functions from other libraries. These functions perform tasks in relation to CrxOop.
crxOop.bindFunction() is a more general form of the javascript bind function, that should work on older browsers as well. crxOop.bindFunction() allows you to fine tune the bind result. Functions bound with crxOop.bindFunction() are aware of the internal CrxOop halt signal, and can also be protected from double binding, as well as other things.
// To create a replacement roughly equivilant to the built in
// bind function when it is not available, one could use:
if(!Function.prototype.bind)
{
Function.prototype.bind = function(pThis)
{
return crxOop.bindFunction(this,
pThis, false, true, -1,
Array.prototype.slice.call(arguments, 1));
};
}
crxOop.var() takes a single parameter, and if the parameter is not a function, returns it. If it is a function, it returns the function such as its 'this' is set to null. Internaly, crxOop.var() uses crxOop.bindFunction(), and will only bind the function if has not been bound to null before using crxOop.var() or crxOop.bindFunction(). If crxOop.var() binds the function, it does it by making the call crxOop.bindFunction(passedInParameter, null, false, true, -1, null).
Equivilant to the javascript setTimeout function, with the added benefit that the timeout will not fire if CrxOop halts.
Equivilant to the javascript setInterval function, with the added benefit that the interval will halt if CrxOop halts.