bpmn-js/lib/features/modeling/behavior/UnclaimIdBehavior.js
Nico Rehwaldt d3449ca87c chore(project): es6ify source code
* use ES6 import / export
* UTILS: export individual utilities
* TESTS: localize TestHelper includes

BREAKING CHANGE:

* all utilities export independent functions
* library sources got ported to ES6. You must now use
  a ES module bundler such as Browserify + babelify or
  Webpack to consume this library (or parts of it).
2018-04-03 16:32:14 +02:00

35 lines
757 B
JavaScript

'use strict';
import {
forEach
} from 'min-dash';
import inherits from 'inherits';
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
/**
* Unclaims model IDs on element deletion.
*
* @param {EventBus} eventBus
* @param {Modeling} modeling
*/
export default function UnclaimIdBehavior(eventBus, modeling) {
CommandInterceptor.call(this, eventBus);
this.preExecute('elements.delete', function(event) {
var context = event.context,
elements = context.elements;
forEach(elements, function(element) {
modeling.unclaimId(element.businessObject.id, element.businessObject);
});
});
}
inherits(UnclaimIdBehavior, CommandInterceptor);
UnclaimIdBehavior.$inject = [ 'eventBus', 'modeling' ];