bpmn-js/lib/Util.js
Nico Rehwaldt 02313e6c1b feat(bpmn): make available BpmnRegistry in renderer
This commit upgrades the code base to the latest diagram-js changes and
adds a component called BpmnRegistry that can be used to retrieve a
certain BPMN/DI element from a shape/connection id.

Related to #19
2014-04-03 11:55:22 +02:00

24 lines
405 B
JavaScript

var _ = require('lodash');
function failSafeAsync(fn) {
return function() {
var args = Array.prototype.slice.call(arguments);
var done = args[args.length - 1];
if (!done || !_.isFunction(done)) {
done = function(e) {
throw e;
};
}
try {
fn.apply(this, args);
} catch (e) {
done(e);
}
};
}
module.exports.failSafeAsync = failSafeAsync;