Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function initialize(env, user, options = {}) {
const platform = browserPlatform(options);
const clientVars = common.initialize(env, user, options, platform, extraOptionDefs);
const client = clientVars.client;
const validatedOptions = clientVars.options;
const emitter = clientVars.emitter;
const goalsPromise = new Promise(resolve => {
const onGoals = emitter.on(goalsEvent, () => {
emitter.off(goalsEvent, onGoals);
resolve();
});
});
client.waitUntilGoalsReady = () => goalsPromise;
if (validatedOptions.fetchGoals) {
const goalManager = GoalManager(clientVars, () => emitter.emit(goalsEvent));
platform.customEventFilter = goalManager.goalKeyExists;