@pandorajs/hub
Version:
pandora.js messenge hub
28 lines • 970 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConfigClient = void 0;
const const_1 = require("../const");
class ConfigClient {
constructor(configManagerProxy) {
this.configManagerProxy = configManagerProxy;
}
static async create(consumerManager) {
const configManagerProxy = await consumerManager.getProxy({
name: const_1.PANDORA_HUB_CONFIG_MANAGER,
});
return new ConfigClient(configManagerProxy);
}
async subscribe(topic, cb) {
await this.configManagerProxy.subscribe(topic, cb);
const config = await this.configManagerProxy.getConfig(topic);
cb(config);
}
async unsubscribe(topic, cb) {
await this.configManagerProxy.unsubscribe(topic, cb);
}
async getConfig(topic) {
return await this.configManagerProxy.getConfig(topic);
}
}
exports.ConfigClient = ConfigClient;
//# sourceMappingURL=ConfigClient.js.map