IOTConnect-Web/node_modules/mqtt/build/lib/topic-alias-recv.js

24 lines
630 B
JavaScript
Raw Normal View History

2024-05-09 01:49:52 +00:00
"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