bloodymary/common/FeatureFlags.js

29 lines
539 B
JavaScript
Raw Normal View History

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