trigger (eventName, options) private
Use trigger
to fire custom events. For example:
object.on('foo', function(){ console.log('foo event happened!'); }); object.trigger('foo'); // 'foo event happened!' logged to the console
You can also pass a value as a second argument to trigger
that will be passed as an argument to all event listeners for the event:
object.on('foo', function(value){ console.log(value.name); }); object.trigger('foo', { name: 'bar' }); // 'bar' logged to the console
Parameters:
-
eventName
String
- name of the event to be triggered
-
options
*
- optional value to be passed to any event handlers for the given `eventName`
Please login to continue.