Declare Objects
You can create objects using JavaScript, also you can assign this object to a variable.
function object(param1, param2){
this.param = param1;
this.param2= param2;
my_function: function(){
}
}
var my_object = object(1, 2);
Properties
To access the properties use object.property
Ej: var name = object.param2;
Using JSON the syntax is object['param2']
Arrays
The arrays can be created with the following sintax
var array = new Array();
var array = new Array('obj1', 'obj2', 'obj3');
var array = ['obj1', 'obj2', 'obj3'];
Functions
$.inArray get the index where is the element.
var element_index = $.inArray('value', array);
Window object
Each time a tab is open a window object is created.
Methods
window.onFocus - tells when a tab is activated.
window.onBlur - detects when the tab lose the focus.
Functions
window.setTimeout( function(){}, 400) - Wait the defined time before call the function
window.setInterval( function(){}, 400) - interval between a function is run repeatedly
window.clearInterval( function(){} ) - wipes clear the schedule of repetead function calls
No hay comentarios:
Publicar un comentario