Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@optimizely/js-sdk-datafile-manager

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@optimizely/js-sdk-datafile-manager

Optimizely Full Stack Datafile Manager

  • 0.9.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @optimizely/js-sdk-datafile-manager?

@optimizely/js-sdk-datafile-manager is a package designed to manage datafiles for Optimizely's JavaScript SDK. It provides functionalities to fetch, cache, and update datafiles, which are essential for running experiments and feature tests using Optimizely's platform.

What are @optimizely/js-sdk-datafile-manager's main functionalities?

Fetching Datafile

This feature allows you to fetch and automatically update the datafile from Optimizely's servers. The datafile is fetched using the provided SDK key, and updates are polled at the specified interval.

const { HttpPollingDatafileManager } = require('@optimizely/js-sdk-datafile-manager');

const datafileManager = new HttpPollingDatafileManager({
  sdkKey: 'your-sdk-key',
  autoUpdate: true,
  updateInterval: 1000 * 60 * 5 // 5 minutes
});

datafileManager.start();

datafileManager.on('update', () => {
  const datafile = datafileManager.get();
  console.log('Datafile updated:', datafile);
});

Caching Datafile

This feature allows you to use a custom cache for storing the datafile. You can provide custom implementations for the get and set methods to control how the datafile is cached.

const { HttpPollingDatafileManager } = require('@optimizely/js-sdk-datafile-manager');

const datafileManager = new HttpPollingDatafileManager({
  sdkKey: 'your-sdk-key',
  autoUpdate: true,
  cache: {
    get: (key) => {/* custom get implementation */},
    set: (key, value) => {/* custom set implementation */}
  }
});

datafileManager.start();

Handling Datafile Updates

This feature allows you to handle datafile updates by listening to the 'update' event. When the datafile is updated, you can retrieve the latest version and perform any necessary actions.

const { HttpPollingDatafileManager } = require('@optimizely/js-sdk-datafile-manager');

const datafileManager = new HttpPollingDatafileManager({
  sdkKey: 'your-sdk-key',
  autoUpdate: true
});

datafileManager.start();

datafileManager.on('update', () => {
  const datafile = datafileManager.get();
  console.log('Datafile updated:', datafile);
});

Other packages similar to @optimizely/js-sdk-datafile-manager

FAQs

Package last updated on 07 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc