mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-29 18:16:44 -06:00
refactor
This commit is contained in:
parent
adb168dfdc
commit
0bab055441
1 changed files with 2 additions and 15 deletions
|
@ -269,12 +269,9 @@ abstract class Connection<Channel extends Channels[keyof Channels] = any> extend
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public send(id: string, typeOrPayload: any, payload?: any) {
|
public send<T extends keyof Channel['receives']>(type: T, body: Channel['receives'][T]) {
|
||||||
const type = payload === undefined ? typeOrPayload.type : typeOrPayload;
|
|
||||||
const body = payload === undefined ? typeOrPayload.body : payload;
|
|
||||||
|
|
||||||
this.stream.send('ch', {
|
this.stream.send('ch', {
|
||||||
id: id,
|
id: this.id,
|
||||||
type: type,
|
type: type,
|
||||||
body: body
|
body: body
|
||||||
});
|
});
|
||||||
|
@ -299,11 +296,6 @@ class SharedConnection<Channel extends Channels[keyof Channels] = any> extends C
|
||||||
this.pool.inc();
|
this.pool.inc();
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
|
||||||
public send(typeOrPayload: any, payload?: any) {
|
|
||||||
super.send(this.pool.id, typeOrPayload, payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public dispose() {
|
public dispose() {
|
||||||
this.pool.dec();
|
this.pool.dec();
|
||||||
|
@ -334,11 +326,6 @@ class NonSharedConnection<Channel extends Channels[keyof Channels] = any> extend
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@autobind
|
|
||||||
public send(typeOrPayload: any, payload?: any) {
|
|
||||||
super.send(this.id, typeOrPayload, payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
@autobind
|
@autobind
|
||||||
public dispose() {
|
public dispose() {
|
||||||
this.removeAllListeners();
|
this.removeAllListeners();
|
||||||
|
|
Loading…
Reference in a new issue