How to use the @optimizely/optimizely-sdk.createInstance function in @optimizely/optimizely-sdk

To help you get started, we’ve selected a few @optimizely/optimizely-sdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github optimizely / isomorphic-react-demo-app / src / client / optimizely_manager.js View on Github external
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
}
github optimizely / javascript-sdk / packages / js-web-sdk / packages / js-web-sdk / src / OptimizelySDKWrapper.ts View on Github external
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()
  }
}
github optimizely / isomorphic-react-demo-app / src / common / utils / optimizely_manager.js View on Github external
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
}
github optimizely / javascript-sdk / packages / eet_validation / src / OptimizelyClientCommand.ts View on Github external
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
  }
}