dispatch
obj.dispatch(event, [args])
Dispatches/triggers a basic event on an object.
var canEvent = require("can-event");
var obj = {};
Object.assign(obj, canEvent);
obj.addEventListener("foo", function(){
console.log("FOO BAR!");
});
obj.dispatch("foo"); // Causes it to log FOO BAR
Parameters
- event
{String|Object}
:The event to dispatch
- args
{Array}
:Additional arguments to pass to event handlers
Returns
{Object}
:
event The resulting event object
canEvent.dispatch.call(obj, event, args)
This syntax can be used for objects that don't include the can.event
mixin.