UNPKG

@logicflow/extension

Version:
31 lines (30 loc) 897 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getBpmnId = void 0; 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; }()); var ids = (globalThis === null || globalThis === void 0 ? void 0 : globalThis._ids) || new IDS(); function getBpmnId() { return ids.next(); } exports.getBpmnId = getBpmnId;