summaryrefslogtreecommitdiff
path: root/web-ui/app
diff options
context:
space:
mode:
authorThiago Colucci and Patrick Maia <pixelated-team+colucci+patrick@thoughtworks.com>2014-08-08 17:02:23 -0300
committerPatrick Maia <patrickjourdanmaia@gmail.com>2014-08-08 17:02:23 -0300
commit71d49858f9c5e6e4e7ea86d137f0c8300456382e (patch)
treed792dfa66bad7b4b21df7a20e429fa2002ddb6a2 /web-ui/app
parent94c10687d493885680c89299a2e948e897fe6979 (diff)
adds ability to define behavior when a feature is toggled off
Diffstat (limited to 'web-ui/app')
-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));
};
}