asarfuckery/appasar/ptb/common/FeatureFlags.js

29 lines
539 B
JavaScript
Raw Normal View History

2019-01-17 18:22:05 +00:00
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
2019-01-19 00:58:12 +00:00
class FeatureFlags {
constructor() {
2019-01-17 18:22:05 +00:00
this.flags = new Set();
}
2019-01-19 00:58:12 +00:00
getSupported() {
return Array.from(this.flags);
}
2019-01-17 18:22:05 +00:00
2019-01-19 00:58:12 +00:00
supports(feature) {
return this.flags.has(feature);
}
2019-01-17 18:22:05 +00:00
2019-01-19 00:58:12 +00:00
declareSupported(feature) {
if (this.supports(feature)) {
console.error('Feature redeclared; is this a duplicate flag? ', feature);
return;
}
2019-01-17 18:22:05 +00:00
2019-01-19 00:58:12 +00:00
this.flags.add(feature);
}
}
2019-01-17 18:22:05 +00:00
exports.default = FeatureFlags;
2019-10-01 13:49:56 +00:00
module.exports = exports.default;