summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--web-ui/app/js/lib/features.js5
-rw-r--r--web-ui/app/js/mixins/with_feature_toggle.js20
2 files changed, 25 insertions, 0 deletions
diff --git a/web-ui/app/js/lib/features.js b/web-ui/app/js/lib/features.js
new file mode 100644
index 00000000..deacc8fe
--- /dev/null
+++ b/web-ui/app/js/lib/features.js
@@ -0,0 +1,5 @@
+define([], function() {
+ return {
+
+ };
+});
diff --git a/web-ui/app/js/mixins/with_feature_toggle.js b/web-ui/app/js/mixins/with_feature_toggle.js
new file mode 100644
index 00000000..3a484388
--- /dev/null
+++ b/web-ui/app/js/mixins/with_feature_toggle.js
@@ -0,0 +1,20 @@
+define(['lib/features'],
+ function(features) {
+
+ function withFeatureToggle(componentName) {
+ return function() {
+
+ var defaultToggle = {enabled: true};
+
+ this.around('initialize', function(basicInitialize) {
+ var featureToggle = features[componentName] || defaultToggle;
+ if(featureToggle.enabled) {
+ basicInitialize(arguments[1], arguments[2]);
+ }
+ });
+ };
+ }
+
+ return withFeatureToggle;
+
+});