fabricjs Fabricjs canvas events


Syntax

  1. on(eventName, handler) - Attaches an event listener with a callback to the object.

  2. off(eventName, handler) - Remove the event listener from the object. Calling this function witout any arguments will remove all event listeners on the object.

  3. trigger(eventName, optionsopt) - Fires the event and optional options object.

Parameters

ParameterDescription
eventNameThe name of the event you want to subscribe such as 'object:moving'
eventHandlerThe function you want to execute when that particluar event is triggered
optionsoptOptions object

Remarks

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