feat(core/BpmnRegistry): api accepts element#id

This commit is contained in:
Nico Rehwaldt 2014-04-25 11:05:08 +02:00
parent 418003a916
commit a842ee80a6
1 changed files with 5 additions and 4 deletions

View File

@ -1,12 +1,13 @@
var bpmnModule = require('../di').defaultModule;
var _ = require('lodash');
var bpmnModule = require('../di').defaultModule;
/**
* @class
*
* A registry that keeps track of bpmn semantic / di elements and the
* corresponding shapes.
*
*
* @param {EventBus} events
* @param {ElementRegistry} elementRegistry
*/
@ -39,8 +40,8 @@ function BpmnRegistry(events, elementRegistry) {
function get(type) {
var collection = elements[type];
return function(id) {
return collection[id];
return function(element) {
return collection[_.isObject(element) ? element.id : element];
};
}