mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-09 16:45:49 +00:00
9be61259bd
We use ES modules, so 'use strict' is not necessary anymore.
37 lines
685 B
JavaScript
37 lines
685 B
JavaScript
export default function IdClaimHandler(moddle) {
|
|
this._moddle = moddle;
|
|
}
|
|
|
|
IdClaimHandler.$inject = [ 'moddle' ];
|
|
|
|
|
|
IdClaimHandler.prototype.execute = function(context) {
|
|
var ids = this._moddle.ids,
|
|
id = context.id,
|
|
element = context.element,
|
|
claiming = context.claiming;
|
|
|
|
if (claiming) {
|
|
ids.claim(id, element);
|
|
} else {
|
|
ids.unclaim(id);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Command revert implementation.
|
|
*/
|
|
IdClaimHandler.prototype.revert = function(context) {
|
|
var ids = this._moddle.ids,
|
|
id = context.id,
|
|
element = context.element,
|
|
claiming = context.claiming;
|
|
|
|
if (claiming) {
|
|
ids.unclaim(id);
|
|
} else {
|
|
ids.claim(id, element);
|
|
}
|
|
};
|
|
|