Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace way of check if plugin charged #100

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/DeviceRendererFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module.exports = class DeviceRendererFactory {

this.instances.push(instance);

this.addPlugins(instance);
this.loadPlugins(instance);
instance.onWebRTCReady();

return instance.apiManager.getExposedApiFunctions();
Expand Down Expand Up @@ -195,7 +195,7 @@ module.exports = class DeviceRendererFactory {
* @param {DeviceRenderer} instance The DeviceRenderer instance reference to link into each plugin.
* @param {Object} options Various configuration options.
*/
addPlugins(instance) {
loadPlugins(instance) {
/*
* Load instance dedicated plugins
*/
Expand All @@ -209,19 +209,20 @@ module.exports = class DeviceRendererFactory {
}
}

const dependenciesLoaded = [];
const dependenciesLoaded = new Map();
pluginInitMap.forEach((plugin) => {
const args = plugin.params || [];

if (plugin.enabled) {
// load dependencies
if (plugin.dependencies) {
plugin.dependencies.forEach((Dep) => {
if (dependenciesLoaded.indexOf(Dep.name) !== -1) {
if (dependenciesLoaded.has(Dep)) {
return;
}

new Dep(instance);
dependenciesLoaded.push(Dep.name);
dependenciesLoaded.set(Dep, true);
});
}
// eslint-disable-next-line no-unused-expressions
Expand Down
Loading