rox-ssr-multi-entrypoints
Version:
Rollout.io SDK with support for multiple entrypoints
38 lines • 1.46 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Flag = void 0;
var rox_ssr_1 = require("rox-ssr");
var Flag = (function (_super) {
__extends(Flag, _super);
function Flag() {
return _super !== null && _super.apply(this, arguments) || this;
}
Flag.prototype.isEnabled = function (context) {
try {
if (!this.name) {
throw new Error('Flag value requested on a flag that wasn\'t registered. Did you initialize Rollout properly?');
}
}
catch (e) {
console.warn(e);
return this.defaultValue === 'true';
}
return rox_ssr_1.Rox.dynamicApi.isEnabled(this.name, this.defaultValue === 'true', context);
};
return Flag;
}(rox_ssr_1.Flag));
exports.Flag = Flag;
//# sourceMappingURL=flag.js.map