Chore: Move some methods to SDK (#3736)
This commit is contained in:
parent
7866ec3f33
commit
765c5c50f8
|
@ -976,16 +976,19 @@ const RocketChat = {
|
||||||
return `${server}/${roomType}/${channel.name}`;
|
return `${server}/${roomType}/${channel.name}`;
|
||||||
},
|
},
|
||||||
subscribe(...args) {
|
subscribe(...args) {
|
||||||
return this.sdk.subscribe(...args);
|
return sdk.subscribe(...args);
|
||||||
|
},
|
||||||
|
subscribeRaw(...args) {
|
||||||
|
return sdk.subscribeRaw(...args);
|
||||||
},
|
},
|
||||||
subscribeRoom(...args) {
|
subscribeRoom(...args) {
|
||||||
return this.sdk.subscribeRoom(...args);
|
return sdk.subscribeRoom(...args);
|
||||||
},
|
},
|
||||||
unsubscribe(subscription) {
|
unsubscribe(subscription) {
|
||||||
return this.sdk.unsubscribe(subscription);
|
return sdk.unsubscribe(subscription);
|
||||||
},
|
},
|
||||||
onStreamData(...args) {
|
onStreamData(...args) {
|
||||||
return this.sdk.onStreamData(...args);
|
return sdk.onStreamData(...args);
|
||||||
},
|
},
|
||||||
emitTyping(room, typing = true) {
|
emitTyping(room, typing = true) {
|
||||||
const { login, settings } = reduxStore.getState();
|
const { login, settings } = reduxStore.getState();
|
||||||
|
|
|
@ -27,6 +27,10 @@ class Sdk {
|
||||||
return this.sdk;
|
return this.sdk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get current() {
|
||||||
|
return this.sdk;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: evaluate the need for assigning "null" to this.sdk
|
* TODO: evaluate the need for assigning "null" to this.sdk
|
||||||
* I'm returning "null" because we need to remove both instances of this.sdk here and on rocketchat.js
|
* I'm returning "null" because we need to remove both instances of this.sdk here and on rocketchat.js
|
||||||
|
@ -141,6 +145,26 @@ class Sdk {
|
||||||
});
|
});
|
||||||
return this.methodCall(method, ...parsedParams);
|
return this.methodCall(method, ...parsedParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subscribe(...args: any[]) {
|
||||||
|
return this.sdk.subscribe(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribeRaw(...args: any[]) {
|
||||||
|
return this.sdk.subscribeRaw(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
subscribeRoom(...args: any[]) {
|
||||||
|
return this.sdk.subscribeRoom(...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsubscribe(subscription: any[]) {
|
||||||
|
return this.sdk.unsubscribe(subscription);
|
||||||
|
}
|
||||||
|
|
||||||
|
onStreamData(...args: any[]) {
|
||||||
|
return this.sdk.onStreamData(...args);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const sdk = new Sdk();
|
const sdk = new Sdk();
|
||||||
|
|
Loading…
Reference in New Issue