Ember.on()

on (eventNames, func) public

Defined in packages/ember-metal/lib/events.js:280

Define a property as a function that should be executed when a specified event or events are triggered.

let Job = Ember.Object.extend({
  logCompleted: Ember.on('completed', function() {
    console.log('Job completed!');
  })
});

let job = Job.create();

Ember.sendEvent(job, 'completed'); // Logs 'Job completed!'

Parameters:

eventNames String
func Function

Returns:

func
doc_EmberJs
2016-11-30 16:51:35
Comments
Leave a Comment

Please login to continue.