UNPKG

630 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3class TopicAliasRecv {
4 constructor(max) {
5 this.aliasToTopic = {};
6 this.max = max;
7 }
8 put(topic, alias) {
9 if (alias === 0 || alias > this.max) {
10 return false;
11 }
12 this.aliasToTopic[alias] = topic;
13 this.length = Object.keys(this.aliasToTopic).length;
14 return true;
15 }
16 getTopicByAlias(alias) {
17 return this.aliasToTopic[alias];
18 }
19 clear() {
20 this.aliasToTopic = {};
21 }
22}
23exports.default = TopicAliasRecv;
24//# sourceMappingURL=topic-alias-recv.js.map
\No newline at end of file