Self ng.Events.add_event (String evt, Function func) vs. 1.1.0 Full+Lite

The add_event method will attach an event listener to an object. When the event is fired, the listeners functions will be executed on last added first run approach. All HTML elements events will be extended automatically by the ng.extend_event.

Parameters

String evt Required vs. 1.1.0 Full+Lite
A string that represent the event name. It can includes the "on" or not. e.g. "click" or "onclick" will be the same event.
Special Cases
You can use the add_event method to add special events in all browsers to HTML Elements. When adding a special event, the HTML Element should have a unique ID.
  • onMouseEnter: This is an IE only event, but the add_event method will simulate the event in other browsers.
  • onMouseLeave: This is an IE only event, but the add_event method will simulate the event in other browsers.
  • onMouseWheel: For gecko based browsers, this event will be changed into DOMMouseScroll and the event.wheel value will be calculated based on the event.detail value.
Function func Required vs. 1.1.0 Full+Lite
The function that will be executed when the event is fired.
Remarks
  • this object in the function will refer to the object that fired the event.
  • For classes' events, this function can receive a list of arguments that is passed through the Events.fire_event(nm, args, evt).
  • For HTML elements, The last arguments will be the event extended with the ng.extend_event(evt)

Return

Self Required vs. 1.1.0 Full+Lite
The original object.

Examples

Using ng.Events.add_event(evt, func)
Adding a mouseenter and mouseleave events to an HTML element.
Demo:
This is a div. Move Mouse Over Here