Fixed 267U.pre2
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import Xev from "xev";
|
||||
import Channel from "../channel.js";
|
||||
const ev = new Xev();
|
||||
export default class extends Channel {
|
||||
chName = "queueStats";
|
||||
static shouldShare = true;
|
||||
static requireCredential = false;
|
||||
constructor(id, connection){
|
||||
super(id, connection);
|
||||
this.onStats = this.onStats.bind(this);
|
||||
this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
async init(params) {
|
||||
ev.addListener("queueStats", this.onStats);
|
||||
}
|
||||
onStats(stats) {
|
||||
this.send("stats", stats);
|
||||
}
|
||||
onMessage(type, body) {
|
||||
switch(type){
|
||||
case "requestLog":
|
||||
ev.once(`queueStatsLog:${body.id}`, (statsLog)=>{
|
||||
this.send("statsLog", statsLog);
|
||||
});
|
||||
ev.emit("requestQueueStatsLog", {
|
||||
id: body.id,
|
||||
length: body.length
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
ev.removeListener("queueStats", this.onStats);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user