refactor: Use ESM (#8358)
* wip * wip * fix * clean up * Update tsconfig.json * Update activitypub.ts * wip
This commit is contained in:
@@ -1,25 +1,27 @@
|
||||
import autobind from 'autobind-decorator';
|
||||
import Xev from 'xev';
|
||||
import Channel from '../channel';
|
||||
import { default as Xev } from 'xev';
|
||||
import Channel from '../channel.js';
|
||||
|
||||
const ev = new Xev();
|
||||
const ev = new Xev.default();
|
||||
|
||||
export default class extends Channel {
|
||||
public readonly chName = 'queueStats';
|
||||
public static shouldShare = true;
|
||||
public static requireCredential = false;
|
||||
|
||||
@autobind
|
||||
constructor(id: string, connection: Channel['connection']) {
|
||||
super(id, connection);
|
||||
this.onStats = this.onStats.bind(this);
|
||||
this.onMessage = this.onMessage.bind(this);
|
||||
}
|
||||
|
||||
public async init(params: any) {
|
||||
ev.addListener('queueStats', this.onStats);
|
||||
}
|
||||
|
||||
@autobind
|
||||
private onStats(stats: any) {
|
||||
this.send('stats', stats);
|
||||
}
|
||||
|
||||
@autobind
|
||||
public onMessage(type: string, body: any) {
|
||||
switch (type) {
|
||||
case 'requestLog':
|
||||
@@ -34,7 +36,6 @@ export default class extends Channel {
|
||||
}
|
||||
}
|
||||
|
||||
@autobind
|
||||
public dispose() {
|
||||
ev.removeListener('queueStats', this.onStats);
|
||||
}
|
||||
|
Reference in New Issue
Block a user