What's new? | Help | Directory | Sign in
Google
jslibs
standalone Javascript development environment with general purpose native libraries.
  
  
  
  
    
Search
for
Updated Feb 27, 2008 by soubok
Labels: doc
jsobjex  
jsobjex module

jsobjex module

home > JSLibs > jsobjex -

Description

jsobjex is a module that contains only ObjEx class.

Exemples

code snippet

jsobjex::ObjEx class

home > JSLibs > jsobjex > ObjEx -

Description

This class give the ability to spy properties changes. One can listen for add, del, set and set events on the object.

It is possible to store an hidden auxiliary object that can be access using ObjEx.Aux( ObjEx object ) static function.

Functions

Static Functions

Events / Callbacks

function addCallback, delCallback, getCallback, setCallback are called according to the operation done on the object.

arguments are: ( propertyName, propertyValue, auxObject, callbackIndex )

Example

function addCallback( name, value ) {
	
  Print('adding ' + name + ' = ' + value);
}

var obj = new ObjEx( addCallback, undefined, undefined, undefined, null );

obj.foo = 123;
obj.foo = 456;

prints:

adding foo = 123

Note that addCallback is called only when the property is being added, in opposition to setCallback that is called each time the value is changed.

Example

http://jsircbot.googlecode.com/svn/trunk/dataObject.js

Sign in to add a comment