summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web-ui/app/js/mixins/with_feature_toggle.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/web-ui/app/js/mixins/with_feature_toggle.js b/web-ui/app/js/mixins/with_feature_toggle.js
index 2b071e68..cf8d0d07 100644
--- a/web-ui/app/js/mixins/with_feature_toggle.js
+++ b/web-ui/app/js/mixins/with_feature_toggle.js
@@ -1,14 +1,17 @@
define(['features'],
function(features) {
- function withFeatureToggle(componentName) {
+ function withFeatureToggle(componentName, behaviorForFeatureOff) {
return function() {
- this.around('initialize', function(basicInitialize) {
+ this.around('initialize', _.bind(function(basicInitialize) {
if(features.isEnabled(componentName)) {
return basicInitialize(arguments[1], arguments[2]);
}
- });
+ else if (behaviorForFeatureOff){
+ behaviorForFeatureOff.bind(this).call();
+ }
+ }, this));
};
}