1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | class 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 | }
|
23 | exports.default = DefaultMessageIdProvider;
|
24 |
|
\ | No newline at end of file |