mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-15 11:35:54 +00:00
d3449ca87c
* 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).
39 lines
700 B
JavaScript
39 lines
700 B
JavaScript
'use strict';
|
|
|
|
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);
|
|
}
|
|
};
|
|
|