mirror of
https://github.com/JasonYANG170/IOTConnect-Web.git
synced 2024-11-23 20:26:28 +00:00
24 lines
630 B
JavaScript
24 lines
630 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
class TopicAliasRecv {
|
|
constructor(max) {
|
|
this.aliasToTopic = {};
|
|
this.max = max;
|
|
}
|
|
put(topic, alias) {
|
|
if (alias === 0 || alias > this.max) {
|
|
return false;
|
|
}
|
|
this.aliasToTopic[alias] = topic;
|
|
this.length = Object.keys(this.aliasToTopic).length;
|
|
return true;
|
|
}
|
|
getTopicByAlias(alias) {
|
|
return this.aliasToTopic[alias];
|
|
}
|
|
clear() {
|
|
this.aliasToTopic = {};
|
|
}
|
|
}
|
|
exports.default = TopicAliasRecv;
|
|
//# sourceMappingURL=topic-alias-recv.js.map
|