UNPKG

@logicflow/extension

Version:
28 lines (27 loc) 784 B
var IDs = /** @class */ (function () { function IDs() { globalThis._ids = this; this._ids = new Set(); } IDs.prototype.generateId = function () { return 'xxxxxxx'.replace(/[x]/g, function (c) { var r = (Math.random() * 16) | 0; var v = c === 'x' ? r : (r & 0x3) | 0x8; return v.toString(16); }); }; IDs.prototype.next = function () { var id = this.generateId(); while (this._ids.has(id)) { id = this.generateId(); } this._ids.add(id); return id; }; return IDs; }()); export { IDs }; var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDs(); export function getBpmnId() { return ids.next(); }