on (name, target, method) public
Subscribes to a named event with given function.
person.on('didLoad', function() {
// fired once the person has loaded
});
An optional target can be passed in as the 2nd argument that will be set as the "this" for the callback. This is a good way to give your function access to the object triggering the event. When the target parameter is used the callback becomes the third argument.
Parameters:
-
name
String - The name of the event
-
target
[Object] - The "this" binding for the callback
-
method
Function - The callback to execute
Returns:
- this
Please login to continue.