UNPKG

649 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class DefaultMessageIdProvider {
4 constructor() {
5 this.nextId = Math.max(1, Math.floor(Math.random() * 65535));
6 }
7 allocate() {
8 const id = this.nextId++;
9 if (this.nextId === 65536) {
10 this.nextId = 1;
11 }
12 return id;
13 }
14 getLastAllocated() {
15 return this.nextId === 1 ? 65535 : this.nextId - 1;
16 }
17 register(messageId) {
18 return true;
19 }
20 deallocate(messageId) { }
21 clear() { }
22}
23exports.default = DefaultMessageIdProvider;
24//# sourceMappingURL=default-message-id-provider.js.map
\No newline at end of file