Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _getInstance(datafile) {
if (!optlyInstance) {
optlyInstance = optimizely.createInstance({
datafile,
logger: optimizelyLoggerFactory.createLogger({
logLevel: 2,
}),
skipJSONValidation: true, // This should be set to false if we modify the datafile in any way
})
}
return optlyInstance
}
private onInitialized() {
const datafile = this.datafileResource.value
if (datafile) {
this.datafile = datafile
}
// can initialize check
if (!this.datafile) {
return
}
this.isInitialized = true
this.instance = optimizely.createInstance({
...this.initialConfig,
datafile: this.datafile,
})
// TODO: make sure this is flushed after notification listeners can be added
this.flushTrackEventQueue()
}
}
function _getInstance(datafile) {
if (!optlyInstance) {
optlyInstance = optimizely.createInstance({
datafile,
logger: optimizelyLoggerFactory.createLogger({
logLevel: 2,
}),
skipJSONValidation: true, // This should be set to false if we modify the datafile in any way
})
}
return optlyInstance
}
async optimizelyClient(): Promise {
if (this._optimizely) {
return this._optimizely
}
const datafile = await this.fetchDatafile()
cli.action.start('Instantiating Optimizely client')
const {flags} = await this.parse(OptimizelyClientCommand)
this._optimizely = optimizely.createInstance({
datafile,
eventDispatcher: new EventDispatcher(flags)
})
cli.action.stop()
return this._optimizely
}
}