mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 02:13:09 +02:00
d0570d7fe3
* wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update CHANGELOG.md * wip * wip * wip * wip * wip * wip * wip * wip * wip * wip * Update CHANGELOG.md * Update CHANGELOG.md * wip * Update CHANGELOG.md * wip * wip * wip * wip
37 lines
726 B
TypeScript
37 lines
726 B
TypeScript
import autobind from 'autobind-decorator';
|
|
import Xev from 'xev';
|
|
import Channel from '../channel';
|
|
|
|
const ev = new Xev();
|
|
|
|
export default class extends Channel {
|
|
@autobind
|
|
public async init(params: any) {
|
|
ev.addListener('serverStats', this.onStats);
|
|
}
|
|
|
|
@autobind
|
|
private onStats(stats: any) {
|
|
this.send('stats', stats);
|
|
}
|
|
|
|
@autobind
|
|
public onMessage(type: string, body: any) {
|
|
switch (type) {
|
|
case 'requestLog':
|
|
ev.once(`serverStatsLog:${body.id}`, statsLog => {
|
|
this.send('statsLog', statsLog);
|
|
});
|
|
ev.emit('requestServerStatsLog', {
|
|
id: body.id,
|
|
length: body.length
|
|
});
|
|
break;
|
|
}
|
|
}
|
|
|
|
@autobind
|
|
public dispose() {
|
|
ev.removeListener('serverStats', this.onStats);
|
|
}
|
|
}
|