What is the role of the BaseViewer.js file

Hello all,

I have been going through the bpmn.js source code and after reading the walkthrough, I’m a little bit unclear on the role of the BaseViewer.js file.

Second, there seems to be no definition for the ‘‘registerProvider()’’ function which is used a few times. I’m in the process of recreating certain aspects of the bpmn-js software tool and I need this function in my implementation.

Thirdly, I want to add icons to the ‘‘Palette Provider’’ (and subsequently the ‘‘Context Pad Provider’’, but there doesn’t seem to be any reference or information on how the current ones (such as ‘bpmn-icon-lasso-tool’ and ‘bpmn-icon-hand-tool’) in the bpmn-js software tool were created or from which library they were imported from. Any assistance to that regard will be appreciated.

Thanks.

1 Like

Hi,

What bothers you? Please explain.

Depending on the feature you use, it should be documented in the diagram-js JS docs.

The icons are currently implemented via GitHub - bpmn-io/bpmn-font: A BPMN 2.0 symbol font. Check out this example: GitHub - bpmn-io/bpmn-js-example-custom-controls: An example how to add custom editor controls to bpmn-js

The icons are currently implemented via GitHub - bpmn-io/bpmn-font: A BPMN 2.0 symbol font. Check out this example: GitHub - bpmn-io/bpmn-js-example-custom-controls: An example how to add custom editor controls to bpmn-js

This example seems to work just for the ones used in the tool. But in my extension of the editor, I’ll like to add the following 4 connectors:
image
which means I need to create these icons. There is no information on if bpmn uses any of these 4 connectors and if not how to draw them so they can be included and used in my extension of the editor.

Together with these connectors I’ll like to be able to create this event and include it in my palette provider and contextpad as well.

image

What bothers you? Please explain.

Saw that it was imported in the Viewer.js file and found no information on it in the walkthrough. The following line of code from the Viewer.js file

inherits(Viewer, BaseViewer);

But there is no mention of which parts are inherited and how relevant are they down the line or if they are over written or not.

The BaseViewer acts as a barebones viewer instance. It defines the viewer API. The Viewer inherits from it and has a single job: Defining modules that the BaseViewer shall instantiate with (cf. module system).

If you are into rewriting parts of the core completely then BaseViewer maybe your destination. Otherwise resort to Viewer or Modeler distributions, depending on your use case.

Does that help?

As you plan to create a full fledged extension I suggest you to follow along our custom element example. It details all steps, including extending palette and context pad: