on (eventNames, func) public
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
Please login to continue.