Core Docs | Additional Modules Docs
@Description: Fires right before saving, if your explicitly return false it cancels
@File: events/formListener.js
@Param: e The event that triggered the save with an additional sb.ajax property
attached that represents the ajax object that will fetch
@Description: A reference to the HTML node which captures all events
@File: events/observer.js
@Description: See sample at top of page
*
@File: events/observer.js
@Param: adds an eventHandler
@Description: See sample at top of page
*
@File: events/observer.js
@Param: removes an eventHandler
@Description: Used to create an eventlistener that responds to events on nodes
with a specific className or combo of classNames in order. Observes by default
@File: events/attributeListener.js
@Param: object params Used to preseed the listener with class listeners
@Return: type desc
@Example:var myListener = new sb.events.attributeListener({
attribute: 'method',
mousemove : {
jump : function(e){
console.log('move '+ new Date());
}
},
click : {
some_value : function(e){
alert('click');
}
}
});
@Description: Used to create an eventlistener that responds to events on nodes
with a specific className or combo of classNames in order. Observes by default
@File: events/classListener.js
@Param: object params Used to preseed the listener with class listeners
@Return: type desc
@Example:var myListener = new sb.events.classListener({
mousemove : {
some_classname : function(e){
console.log('move '+ new Date());
}
},
click : {
some_classname : function(e){
alert('click');
}
}
});
@Description: Observes the events the object has
@File: events/listener.js
@Return: object The event observer
@Example:myListener.unobserve();
@Description: Observes the events the object has. You must rerun this if you are
adding new events. Not required if just adding new classname to manage.
@File: events/listener.js
@Return: object The event observer
@Example:myListener.observe();
@Description: used to create a new form listener that saves data back to a set url
@File: events/formListener.js
@Param: object params Used to preseed the listener with class listeners
@Return: type desc
@Example:<input name="fname" sb:set_url="/admin/set_value" value="joe" />
var myListener = new sb.events.formListener({
onBeforeSave : function(e){
}
});
//when you hit enter it would pass the data back to the url given
@Description: gets the mouse wheel delta e.g. the direction and amount it is being spun
@File: events/getWheelDirection.js
@Param: Object event An event reference as passed to a handler function as e
@Return: Number The wheel delta either 1 or -1 depending on the direction
@Example:function printDelta(e){
document.title = sb.events.getWheelDirection(e);
}
//firefox/safari/opera
sb.events.add('#box', 'DOMMouseScroll', printDelta);
//ie
sb.events.add('#box', 'mousewheel', printDelta);
@Description: Used to create an idListener that responds to events on nodes.
@File: events/idListener.js
@Param: object params Used to preseed the listener with id listeners
@Return: type desc
@Example:var myListener = new sb.events.idListener({
mousemove : {
some_id1 : function(e){
console.log('move '+ new Date());
}
},
click : {
some_other_id : function(e){
alert('click');
}
}
});
@Description: gets key press data for an event making it easy to know which keys were pressed
@File: events/keys.js
@Param: Object event An event reference as passed to a handler function as e
@Return: Object A key press object witht the properties listed in the sb.events.keys method
@Example:var myEvent = sb.events.add('#textArea', 'keydown', function(e){
var keys = sb.events.keys(e);
alert(keys.alt); //would be true if alt was pressed during the keypress - other keys listed below
});
@Description: sets up a global event dispatcher that passes global events to events listeners you set it to observe
@File: events/observer.js
@Version: 1.0 03/11/09 03/11/09
@Param: Object event An event reference as passed to a handler function as e
@Return: Return sthe event listener itself, can be used to remove the event listener by passing as the argument to sb.events.observer.unobserve();
@Example:var eventListener = {
events : {
click : function(e){
alert('click '+e.target);
},
submit : function(e){
e.preventDefault();
alert('submit');
}
}
};
sb.events.observer.observe(eventListener);
//then you can remove with
// sb.events.observer.unobserve(eventListener);