Hi, i’m trying to build some custom behavior for the bpmn-js tool, i’m creating a panel to update the element properties and created this function for that:
export function setAttributes(modeler, element, data){
modeler.invoke(function setAttributesHandler(elementRegistry, modeling){
console.log(elementRegistry, modeling);
modeling.updateProperties(element, data);
});
}
the problem is when i uglify the code, the parameters for the callback function become just one letter each one, and the inject is not finding those parameters, then the question would be, what is the best approach to avoid this behavior (uglify is a most for my project)?, i’ve been looking on github, but i can’t find anything related.
thanks in advanced for your help.
Answer
You have to explicitly add the name information for injected services, as they get mangled during minification. One way to do this is using the Array notation:
[ 'foo', 'bar', fn ]
.A bit more elaborated example could look like that:
modeler.get('eventBus').invoke([ 'foo', 'bar', function(foo, bar) { ... }]);
See details in this answer.