How to use the @optimizely/js-sdk-utils.objectValues function in @optimizely/js-sdk-utils

To help you get started, we’ve selected a few @optimizely/js-sdk-utils 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 / core / notification_center / index.js View on Github external
NotificationCenter.prototype.clearAllNotificationListeners = function () {
  try{
    utils.objectValues(enums.NOTIFICATION_TYPES).forEach(function (notificationTypeEnum) {
      this.__notificationListeners[notificationTypeEnum] = [];
    }.bind(this));
  } catch (e) {
    this.logger.log(LOG_LEVEL.ERROR, e.message);
    this.errorHandler.handleError(e);
  }
};
github optimizely / javascript-sdk / packages / event-processor / src / eventDispatcher.browser.ts View on Github external
stop(): Promise {
    try {
      super.stop()
      const toSave = objectValues(this.buffer).map(obj => ({
        ...obj,
        status: EntryStatus.QUEUED,
      }))
      window.localStorage.setItem(LS_KEY, JSON.stringify(toSave))
    } catch (e) {
      logger.error('Error stopping BrowserDispatchQueue: "%s"', e.message, e)
    }
    return Promise.resolve()
  }
}
github optimizely / javascript-sdk / packages / optimizely-sdk / lib / core / notification_center / index.js View on Github external
NotificationCenter.prototype.addNotificationListener = function (notificationType, callback) {
  try {
    var isNotificationTypeValid = utils.objectValues(enums.NOTIFICATION_TYPES)
      .indexOf(notificationType) > -1;
    if (!isNotificationTypeValid) {
      return -1;
    }

    if (!this.__notificationListeners[notificationType]) {
      this.__notificationListeners[notificationType] = [];
    }

    var callbackAlreadyAdded = false;
    this.__notificationListeners[notificationType].forEach(function (listenerEntry) {
      if (listenerEntry.callback === callback) {
        callbackAlreadyAdded = true;
        return false;
      }
    });
github optimizely / javascript-sdk / packages / optimizely-sdk / lib / core / notification_center / index.js View on Github external
function NotificationCenter(options) {
  this.logger = options.logger;
  this.errorHandler = options.errorHandler;
  this.__notificationListeners = {};
  utils.objectValues(enums.NOTIFICATION_TYPES).forEach(function(notificationTypeEnum) {
    this.__notificationListeners[notificationTypeEnum] = [];
  }.bind(this));
  this.__listenerId = 1;
}