How to use @optimizely/js-sdk-event-processor - 3 common examples

To help you get started, we’ve selected a few @optimizely/js-sdk-event-processor 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 / javascript-sdk / packages / optimizely-sdk / lib / index.browser.js View on Github external
} catch (ex) {
        logger.error(ex);
        config.isValidInstance = false;
      }

      // Explicitly check for null or undefined
      // prettier-ignore
      if (config.skipJSONValidation == null) { // eslint-disable-line eqeqeq
        config.skipJSONValidation = true;
      }

      var eventDispatcher;
      // prettier-ignore
      if (config.eventDispatcher == null) { // eslint-disable-line eqeqeq
        // only wrap the event dispatcher with pending events retry if the user didnt override
        eventDispatcher = new eventProcessor.LocalStoragePendingEventsDispatcher({
          eventDispatcher: defaultEventDispatcher,
        });

        if (!hasRetriedEvents) {
          eventDispatcher.sendPendingEvents();
          hasRetriedEvents = true;
        }
      } else {
        eventDispatcher = config.eventDispatcher;
      }

      config = fns.assignIn(
        {
          clientEngine: enums.JAVASCRIPT_CLIENT_ENGINE,
          eventBatchSize: DEFAULT_EVENT_BATCH_SIZE,
          eventFlushInterval: DEFAULT_EVENT_FLUSH_INTERVAL,
github optimizely / javascript-sdk / packages / optimizely-sdk / lib / optimizely / index.js View on Github external
this.logger.log(LOG_LEVEL.WARNING, ex.message);
    }
  }

  this.decisionService = decisionService.createDecisionService({
    userProfileService: userProfileService,
    logger: this.logger,
    UNSTABLE_conditionEvaluators: config.UNSTABLE_conditionEvaluators
  });

  this.notificationCenter = notificationCenter.createNotificationCenter({
    logger: this.logger,
    errorHandler: this.errorHandler,
  });

  this.eventProcessor = new eventProcessor.LogTierV1EventProcessor({
    dispatcher: this.eventDispatcher,
    flushInterval: config.eventFlushInterval,
    maxQueueSize: config.eventBatchSize,
    notificationCenter: this.notificationCenter,
  });
  this.eventProcessor.start();

  this.__readyTimeouts = {};
  this.__nextReadyTimeoutId = 0;
}
github optimizely / javascript-sdk / packages / optimizely-sdk / lib / optimizely / index.js View on Github external
} catch (ex) {
      this.logger.log(LOG_LEVEL.WARNING, ex.message);
    }
  }

  this.decisionService = decisionService.createDecisionService({
    userProfileService: userProfileService,
    logger: this.logger,
  });

  this.notificationCenter = notificationCenter.createNotificationCenter({
    logger: this.logger,
    errorHandler: this.errorHandler,
  });

  this.eventProcessor = new eventProcessor.LogTierV1EventProcessor({
    dispatcher: this.eventDispatcher,
    flushInterval: config.eventFlushInterval || DEFAULT_EVENT_FLUSH_INTERVAL,
    maxQueueSize: config.eventBatchSize || DEFAULT_EVENT_MAX_QUEUE_SIZE,
  });
  this.eventProcessor.start();
}

@optimizely/js-sdk-event-processor

Optimizely Full Stack Event Processor

Apache-2.0
Latest version published 7 months ago

Package Health Score

79 / 100
Full package analysis