bpmn-js-differ icon indicating copy to clipboard operation
bpmn-js-differ copied to clipboard

Support sub-classing

Open joewarner opened this issue 1 month ago • 1 comments

Problem

We would like to develop a new ChangeHandler class that digs deeper into the BPMN Extension elements. We aren’t interested in changing your ChangeHandler for the standard BPMN elements - it works fine for those. But it doesn’t do such a good job with the extension elements and so we would like to be able to write our own. (Would also make it easier for Camunda to do the same :-)

Specifically, the base implementation tells us that an extension element is different but doesn’t give more detail as to how. We want to do this without losing (or having to duplicate) the ‘standard’ capabilities provided in the existing base implementation. We are struggling with this because of the isTracked function which is a module-scoped standalone function and not a prototype method. Thus we cannot override it through inheritance, making it impossible to extend the tracking logic.

Proposed Solution

As indicated, make the isTracked function a prototype method and add an export for the ChangeHandler. That said there are probably other ways you may choose to implement this - but hopefully the intent is clear.

Alternatives

We considered Monkey patching but this doesn’t seem to be feasible in this case. For now we have duplicated the ChangeHandler whilst we experiment but we think this introduces a maintenance problem because every time your base implementation changes then we would have to apply those changes to our copy which we feel would be an unnecessary burden for the sake of a relatively minor change at your end.

Additional context

None.

joewarner avatar Nov 05 '25 15:11 joewarner