Difference between label and non-label-obj in businessObject?

What is the best way to differentiate between label and non-label-objects in businessObject?
(elementRegistry.get(“EndEvent_07gaa7k_label”).businessObject.$type is “bpmn:EndEvent”)

Please see LabelUtil to check how it is done in bpmn-js: https://github.com/bpmn-io/bpmn-js/blob/master/lib/features/label-editing/LabelUtil.js

Thank you!!

stupid question: how can I load module LabelUtil w.i.t.h.o.u.t. require?
(lib is browserified in modeler.bundled.js)

I am not sure what you want to achieve. Can you please provide a code example with explanation why import is not possible?

53

import is new for me, first tries didn’t work out in chrome. I’ll read.

You’d have to bundle it if you want to use it in the browser. Alternatively you can simply copy the code or even easier:

if (myElement.labelTarget) {
  // ... this element is a label
}

Thank you! So, next to browserifying of modeler, the respective module has to be bundled? There is no bpmnModeler.get?

Actually, which objects belong to the official API? Everything I can get with elementRegistry.get? So more than businessObject?

LabelUtil is only a utility that is used by other modules. Therefore it’s not available through modeler.get.

You can get diagram shapes through ElementRegistry#get. All of these have a businessObject property containing the BPMN-specific information of the element.

1 Like

Thank you very much!!