Please move this logic to the Configurator library (js/configurator.js). It could expose singleVariantApps thought and something what you need