on(eventName, handler) - Attaches an event listener with a callback to the object.
off(eventName, handler) - Remove the event listener from the object. Calling this function witout any arguments will remove all event listeners on the object.
trigger(eventName, optionsopt) - Fires the event and optional options object.
Parameter | Description |
---|---|
eventName | The name of the event you want to subscribe such as 'object:moving' |
eventHandler | The function you want to execute when that particluar event is triggered |
optionsopt | Options object |
Fabric supports a number of events to allow for interactivity and extensibility. In order to subscribe to events for a canvas use the on
method the way its used in jQuery. And you wish to manually trigger any event use the trigger
method. All the events are within the scope of a particular canvas instance. Visit Link for more information on events