File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ FeatureFlagManager.prototype.fetchFlags = function() {
52
52
if ( ! responseFlags ) {
53
53
throw new Error ( 'No flags in API response' ) ;
54
54
}
55
- var flags = { } ;
55
+ var flags = new Map ( ) ;
56
56
_ . each ( responseFlags , function ( data , key ) {
57
- flags [ key ] = {
57
+ flags . set ( key , {
58
58
'key' : data [ 'variant_key' ] ,
59
59
'data' : data [ 'variant_value' ]
60
- } ;
60
+ } ) ;
61
61
} ) ;
62
62
this . flags = flags ;
63
63
} . bind ( this ) ) . catch ( function ( error ) {
@@ -87,7 +87,7 @@ FeatureFlagManager.prototype.getFeatureSync = function(featureName, fallback) {
87
87
logger . log ( 'Flags not loaded yet' ) ;
88
88
return fallback ;
89
89
}
90
- var feature = this . flags [ featureName ] ;
90
+ var feature = this . flags . get ( featureName ) ;
91
91
if ( ! feature ) {
92
92
logger . log ( 'No flag found: "' + featureName + '"' ) ;
93
93
return fallback ;
@@ -132,7 +132,9 @@ FeatureFlagManager.prototype.isFeatureEnabledSync = function(featureName, fallba
132
132
} ;
133
133
134
134
function minApisSupported ( ) {
135
- return ! ! fetch ;
135
+ return ! ! fetch &&
136
+ typeof Promise !== 'undefined' &&
137
+ typeof Map !== 'undefined' ;
136
138
}
137
139
138
140
safewrapClass ( FeatureFlagManager ) ;
You can’t perform that action at this time.
0 commit comments