Remove optional in plugin init/deinit
Reviewed By: mweststrate Differential Revision: D35965072 fbshipit-source-id: 0be6b538d371e41b438263a6a4161b079861b293
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ee013e29fc
commit
3ac93d301a
@@ -624,16 +624,18 @@ export default class Client extends EventEmitter {
|
|||||||
|
|
||||||
initPlugin(pluginId: string) {
|
initPlugin(pluginId: string) {
|
||||||
this.activePlugins.add(pluginId);
|
this.activePlugins.add(pluginId);
|
||||||
if (this.connected.get()) {
|
const instance = this.sandyPluginStates.get(pluginId);
|
||||||
|
if (this.connected.get() && instance) {
|
||||||
this.rawSend('init', {plugin: pluginId});
|
this.rawSend('init', {plugin: pluginId});
|
||||||
this.sandyPluginStates.get(pluginId)?.connect();
|
instance.connect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
deinitPlugin(pluginId: string) {
|
deinitPlugin(pluginId: string) {
|
||||||
this.activePlugins.delete(pluginId);
|
this.activePlugins.delete(pluginId);
|
||||||
this.sandyPluginStates.get(pluginId)?.disconnect();
|
const instance = this.sandyPluginStates.get(pluginId);
|
||||||
if (this.connected.get()) {
|
instance?.disconnect();
|
||||||
|
if (this.connected.get() && instance) {
|
||||||
this.rawSend('deinit', {plugin: pluginId});
|
this.rawSend('deinit', {plugin: pluginId});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user