Skip to content

Commit

Permalink
DEV: prevent double init of mindvision
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastientromp committed Jul 15, 2021
1 parent 8de2c3b commit 8c08f3d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -384,25 +384,26 @@ export class MindVisionService {
return;
}

this.initialized = false;
this.initialized = true;
try {
console.log('[mind-vision] plugin init starting', this.mindVisionPlugin);
this.mindVisionPlugin = new OverwolfPlugin('mind-vision', true);
this.mindVisionPlugin.initialize(async (status: boolean) => {
if (status === false) {
console.error("[mind-vision] Plugin couldn't be loaded??", 'retrying');
this.initialized = false;
setTimeout(() => this.initialize(), 2000);
return;
}
console.log('[mind-vision] Plugin ' + this.mindVisionPlugin.get()._PluginName_ + ' was loaded!');
this.initialized = true;
});
const plugin = await this.get();
plugin.onGlobalEvent.addListener((first: string, second: string) => {
console.log('[mind-vision] received global event', first, second);
});
} catch (e) {
console.warn('[mind-vision]Could not load plugin, retrying', e);
this.initialized = false;
setTimeout(() => this.initialize(), 2000);
}
}
Expand Down

0 comments on commit 8c08f3d

Please sign in to comment.