mirror of https://github.com/Hypfer/Valetudo.git
23 lines
500 B
JavaScript
23 lines
500 B
JavaScript
const HassAnchorSubscriber = require("./HassAnchorSubscriber");
|
|
|
|
class CallbackHassAnchorSubscriber extends HassAnchorSubscriber {
|
|
/**
|
|
* @callback cb
|
|
* @param {import("./HassAnchor")} anchor
|
|
* @return {Promise<void>}
|
|
*/
|
|
/**
|
|
* @param {cb} callback
|
|
*/
|
|
constructor(callback) {
|
|
super();
|
|
this.callback = callback;
|
|
}
|
|
|
|
async onAnchorPost(anchor) {
|
|
await this.callback(anchor);
|
|
}
|
|
}
|
|
|
|
module.exports = CallbackHassAnchorSubscriber;
|