2015-04-27 14:50:09 +00:00
|
|
|
/**
|
|
|
|
* Is an element of the given BPMN type?
|
|
|
|
*
|
|
|
|
* @param {djs.model.Base|ModdleElement} element
|
2020-04-03 13:51:45 +00:00
|
|
|
* @param {string} type
|
2015-04-27 14:50:09 +00:00
|
|
|
*
|
2020-04-06 08:26:04 +00:00
|
|
|
* @return {boolean}
|
2015-04-27 14:50:09 +00:00
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export function is(element, type) {
|
2015-04-27 14:50:09 +00:00
|
|
|
var bo = getBusinessObject(element);
|
|
|
|
|
2015-08-10 13:13:34 +00:00
|
|
|
return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type);
|
2015-04-27 14:50:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the business object for a given element.
|
|
|
|
*
|
|
|
|
* @param {djs.model.Base|ModdleElement} element
|
|
|
|
*
|
|
|
|
* @return {ModdleElement}
|
|
|
|
*/
|
2018-04-02 19:01:53 +00:00
|
|
|
export function getBusinessObject(element) {
|
2015-04-27 14:50:09 +00:00
|
|
|
return (element && element.businessObject) || element;
|
2021-08-06 08:35:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the di object for a given element.
|
|
|
|
*
|
|
|
|
* @param {djs.model.Base} element
|
|
|
|
*
|
|
|
|
* @return {ModdleElement}
|
|
|
|
*/
|
|
|
|
export function getDi(element) {
|
|
|
|
return element && element.di;
|
2018-04-02 19:01:53 +00:00
|
|
|
}
|