The root namespace for the Evento library.
- Source:
- maria.js, line 16
 
Classes
Methods
- 
    <static> off(element, type, listener, auxArg)
- 
    
    
    Removes added listener matching the element/type/listener/auxArg combination exactly. If this combination is not found there are no errors. var o = {handleEvent:function(){}, handleClick:function(){}}; evento.off(document.body, 'click', o); evento.off(document.body, 'click', o, 'handleClick'); evento.off(document.body, 'click', o, fn); evento.off(document.body, 'click', fn); evento.off(document.body, 'click', this.handleClick, this);Parameters:Name Type Argument Description elementEventTarget The object you'd like to stop observing. typestring The name of the event. listenerObject | function The listener object or callback function. auxArgstring | Object <optional> 
 See description. - Source:
- maria.js, line 287
 
 
- 
    <static> on(element, type, listener, auxArg)
- 
    
    
    If the listener is an object then when a matching event type is dispatched on the event target, the listener object's handleEventmethod will be called. By supplying a string value forauxArg, you can specify the name of the method to be called. You can also supply a function object forauxArgfor early binding.If the listener is a function then when a matching event type is dispatched on the event target, the listener function is called with event target object set as the thisobject. Using theauxArg, you can specifiy a different object to be thethisobject.One listener (or type/listener/auxArg pair to be more precise) can be added only once. var o = { handleEvent: function(){}, handleClick: function(){} }; // late binding. handleEvent is found when each event is dispatched evento.on(document.body, 'click', o); // late binding. handleClick is found when each event is dispatched evento.on(document.body, 'click', o, 'handleClick'); // early binding. The supplied function is bound now evento.on(document.body, 'click', o, o.handleClick); evento.on(document.body, 'click', o, function(){}); // supplied function will be called with document.body as this object evento.on(document.body, 'click', function(){}); // The following form is supported but is not neccessary given the options // above and it is recommended you avoid it. evento.on(document.body, 'click', this.handleClick, this);Parameters:Name Type Argument Description elementEventTarget The object you'd like to observe. typestring The name of the event. listenerObject | function The listener object or callback function. auxArgstring | Object <optional> 
 See description. - Source:
- maria.js, line 285
 
 
- 
    <static> purge(listener)
- 
    
    
    Removes all registrations of the listener added through evento.on. This purging should be done before your application code looses its last reference to listener. (This can also be done with more work usingevento.offfor each registeration.) If the listeners are not removed or purged, the listener will continue to observe theEventTargetand cannot be garbage collected. In an MVC application this can lead to "zombie views" if the model data cannot be garbage collected. Event listeners need to be removed from event targets in browsers with circular reference memory leak problems (i.e. old versions of Internet Explorer.)The primary motivation for this purgefunction is to ease cleanup in MVC View destroy methods. For example,var APP_BoxView = function(model, controller) { this.model = model || new APP_BoxModel(); this.controller = controller || new APP_BoxController(); this.rootEl = document.createElement('div'); // subscribe to DOM node(s) and model object(s) or anything else // implementing the EventTarget interface using listener objects // and specifying method name using the same subscription interface. // evento.on(this.rootEl, 'click', this, 'handleClick'); evento.on(this.model, 'change', this, 'handleModelChange'); }; APP_BoxView.prototype.handleClick = function() { // might subscribe/unsubscribe to more DOM nodes or models here }; APP_BoxView.prototype.handleModelChange = function() { // might subscribe/unsubscribe to more DOM nodes or models here }; APP_BoxView.prototype.destroy = function() { // Programmer doesn't need to remember anything. Purge all subscriptions // to DOM nodes, model objects, or anything else implementing // the EventTarget interface in one fell swoop. // evento.purge(this); };Parameters:Name Type Description listenerEventListener The listener object that should stop listening. - Source:
- maria.js, line 289