matterbridge-roborock-vacuum-plugin
Version:
Matterbridge Roborock Vacuum Plugin
17 lines • 541 B
JavaScript
export class ModeHandlerRegistry {
handlers = [];
register(handler) {
this.handlers.push(handler);
return this;
}
async handle(duid, mode, activity, context) {
const handler = this.handlers.find((h) => h.canHandle(mode, activity));
if (handler) {
await handler.handle(duid, mode, activity, context);
}
else {
context.logger.notice(`${context.behaviorName}-changeToMode-Unknown: `, mode);
}
}
}
//# sourceMappingURL=modeHandlerRegistry.js.map