fabric
Version:
Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.
19 lines (17 loc) • 387 B
text/typescript
import type {
ObjectModificationEvents,
TModificationEvents,
} from '../EventTypeDefs';
export const fireEvent = (
eventName: TModificationEvents,
options: ObjectModificationEvents[typeof eventName],
) => {
const {
transform: { target },
} = options;
target.canvas?.fire(`object:${eventName}`, {
...options,
target,
});
target.fire(eventName, options);
};