refactor: introduce bindThis decorator to bind this automaticaly

This commit is contained in:
syuilo
2022-12-04 15:03:09 +09:00
parent e73581f715
commit bbb49457f9
199 changed files with 969 additions and 96 deletions

View File

@@ -1,4 +1,5 @@
import { Inject, Injectable } from '@nestjs/common';
import { bindThis } from '@/decorators.js';
import Channel from '../channel.js';
class DriveChannel extends Channel {
@@ -6,6 +7,7 @@ class DriveChannel extends Channel {
public static shouldShare = true;
public static requireCredential = true;
@bindThis
public async init(params: any) {
// Subscribe drive stream
this.subscriber.on(`driveStream:${this.user!.id}`, data => {
@@ -23,6 +25,7 @@ export class DriveChannelService {
) {
}
@bindThis
public create(id: string, connection: Channel['connection']): DriveChannel {
return new DriveChannel(
id,