UNPKG

@splitsoftware/splitio-browserjs

Version:
28 lines (27 loc) 1.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SplitFactory = void 0; var settings_1 = require("./settings"); var getModules_1 = require("./platform/getModules"); var index_1 = require("@splitsoftware/splitio-commons/cjs/sdkFactory/index"); var getFetchSlim_1 = require("./platform/getFetchSlim"); var getEventSource_1 = require("./platform/getEventSource"); var MinEvents_1 = require("@splitsoftware/splitio-commons/cjs/utils/MinEvents"); var browser_1 = require("@splitsoftware/splitio-commons/cjs/utils/timeTracker/now/browser"); var platform = { getFetch: getFetchSlim_1.getFetch, getEventSource: getEventSource_1.getEventSource, EventEmitter: MinEvents_1.EventEmitter, now: browser_1.now }; /** * SplitFactory with pluggable modules for Browser. * * @param config - configuration object used to instantiate the SDK * @param __updateModules - optional function that lets redefine internal SDK modules. Use with * caution since, unlike `config`, this param is not validated neither considered part of the public API. * @throws Will throw an error if the provided config is invalid. */ function SplitFactory(config, __updateModules) { var settings = (0, settings_1.settingsFactory)(config); var modules = (0, getModules_1.getModules)(settings, platform); if (__updateModules) __updateModules(modules); return (0, index_1.sdkFactory)(modules); } exports.SplitFactory = SplitFactory;