Calling BPMN Toolkit function outside from another javascript function

Hi All,

I need to access the bpmn toolkit modeler function outside from another JavaScript function.

Can anyone to help me, how to call those functions outside.

Thanks

What would you like to do (give us some code snippets, details)?

250: [
function (e, t, n) {
'use strict';
function i(e) {
var t = e.split('-');
return {
horizontal: t[0] || 'center',
vertical: t[1] || 'top'
}
}
function r(e) {
return p(e) ? d({
top: 0,
left: 0,
right: 0,
bottom: 0
}, e)  : {
top: e,
left: e,
right: e,
bottom: e
}
}
function o(e, t) {
return t.textContent = e,
h(t.getBBox(), [
'width',
'height'
])
}
function a(e, t, n) {
for (var i, r = e.shift(), a = r; ; ) {
if (i = o(a, n), i.width = a ? i.width : 0, ' ' === a || '' === a || i.width < Math.round(t) || a.length < 4) return s(e, a, r, i);
a = l(a, i.width, t)
}
}
function s(e, t, n, i) {
if (t.length < n.length) {
var r = e[0] || '',
o = n.slice(t.length).trim();
r = /-\s*$/.test(o) ? o.replace(/-\s*$/, '') + r.replace(/^\s+/, '')  : o + ' ' + r,
e[0] = r
}
return {
width: i.width,
height: i.height,
text: t
}
}
function c(e, t) {
var n,
i = e.split(/(\s|-)/g),
r = [
],
o = 0;
if (i.length > 1) for (; n = i.shift(); ) {
if (!(n.length + o < t)) {
'-' === n && r.pop();
break
}
r.push(n),
o += n.length
}
return r.join('')
}
function l(e, t, n) {
var i = Math.max(e.length * (n / t), 1),
r = c(e, i);
return r || (r = e.slice(0, Math.max(Math.round(i - 1), 1))),
r
}
function u(e) {
this._config = d({
}, {
size: b,
padding: y,
style: {
},
align: 'center-top'
}, e || {
})
}
var p = e('lodash/lang/isObject'),
d = e('lodash/object/assign'),
h = e('lodash/object/pick'),
f = e('lodash/collection/forEach'),
m = e('lodash/collection/reduce'),
g = e('lodash/object/merge'),
v = e('../../vendor/snapsvg'),
y = 0,
b = {
width: 150,
height: 50
};
u.prototype.createText = function (e, t, n) {
for (var o = g({
}, this._config.size, n.box || {
}), s = g({
}, this._config.style, n.style || {
}), c = i(n.align || this._config.align), l = r(void 0 !== n.padding ? n.padding : this._config.padding), u = t.split(/\r?\n/g), p = [
], d = o.width - l.left - l.right, h = e.paper.text(0, 0, '').attr(s).node; u.length; ) p.push(a(u, d, h));
var y,
b,
x = m(p, function (e, t, n) {
return e + t.height
}, 0);
switch (c.vertical) {
case 'middle':
y = (o.height - x) / 2 - p[0].height / 4;
break;
default:
y = l.top
}
var E = e.text().attr(s);
return f(p, function (e) {
switch (y += e.height, c.horizontal) {
case 'left':
    b = l.left;
    break;
case 'right':
    b = d - l.right - e.width;
    break;
default:
    b = Math.max((d - e.width) / 2 + l.left, 0)
}
var t = v.create('tspan', {
x: b,
y: y
}).node;
t.textContent = e.text,
E.append(t)
}), h.parentNode.removeChild(h), E
},
t.exports = u
},
{
'../../vendor/snapsvg': 258,
'lodash/collection/forEach': 274,
'lodash/collection/reduce': 278,
'lodash/lang/isObject': 391,
'lodash/object/assign': 396,
'lodash/object/merge': 399,
'lodash/object/pick': 402
}
],

How to call this function “createText” outside from another javascript function.

I assume you refer to Text#createText?

We advice you against using these internal utility functions as they can change at any time.

If you are in a Common JS environment, i.e. use webpack or browserify to bundle your application you can simply require it:

var Text = require('diagram-js/lib/util/Text');

In other contexts (using bpmn-js from bundle) you will not be able to access the utility.