Evented#on()

on (name, target, method) public

Defined in packages/ember-runtime/lib/mixins/evented.js:52

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
doc_EmberJs
2016-11-30 16:52:06
Comments
Leave a Comment

Please login to continue.