1 import {GraphChange, SVGPlugin} from "./plugin";
2 import {Workflow} from "../graph/workflow";
4 export abstract class PluginBase implements SVGPlugin {
6 protected workflow: Workflow;
8 /** plugin should trigger before a change is about to occur on the model */
9 protected onBeforeChange: (change: GraphChange) => void;
11 /** plugin should trigger after a change has occurred on the model */
12 protected onAfterChange: (change: GraphChange) => void;
14 /** plugin should trigger when internal svg elements have been deleted and new ones created */
15 protected onAfterRender: (change: GraphChange) => void;
17 registerWorkflow(workflow: Workflow): void {
18 this.workflow = workflow;
21 registerOnBeforeChange(fn: (change: GraphChange) => void): void {
22 this.onBeforeChange = fn;
25 registerOnAfterChange(fn: (change: GraphChange) => void): void {
26 this.onAfterChange = fn;
29 registerOnAfterRender(fn: (change: GraphChange) => void): void {
30 this.onAfterRender = fn;