@rollout.io/sdk-js
v5.0.9
Published
The official JavaScript SDK for the Rollout.io feature management platform. High-performance, real-time evaluations for browsers and Node.js.
Maintainers
Readme
Rollout.io JavaScript SDK (v5.0.1) 🚀
Official JavaScript and Node.js SDK for the Rollout.io platform. High-performance, real-time feature flag evaluation and automated telemetry reporting.
📦 Installation
# via npm
npm install @rollout.io/sdk-js
# via yarn
yarn add @rollout.io.sdk-js🛠️ Usage
ES Modules (React, Vue, Modern Node.js)
import Rollout from '@rollout.io/sdk-js';
const setup = async () => {
await Rollout.init({
sdkKey: 'sdk_...',
userId: 'user_123',
baseUrl: 'http://localhost:5000'
});
const isEnabled = Rollout.getFlag('new_feature', false);
};CommonJS (Legacy Node.js)
const Rollout = require('@rollout.io/sdk-js');
Rollout.init({ ... }).then(() => {
const isEnabled = Rollout.getFlag('new_feature', false);
});💎 TypeScript Support
This SDK includes first-class TypeScript support. You'll get rich autocompletion and type-safety out of the box in VS Code and other modern IDEs.
import { RolloutConfig } from '@rollout.io/sdk-js';
const config: RolloutConfig = {
sdkKey: 'sdk_...',
userId: 'user_123'
};⚡ Key Features
- Deterministic Evaluations: Consistent results for specific users across all platforms.
- Fire-and-Forget Reporting: Telemetry is sent asynchronously to prevent UI lags or request blocking.
- Dynamic Polling: Built-in support for 1Hz to 60s background updates.
- Fail-Safe Fallbacks: Guaranteed availability via provided default values.
🛡️ License
Distributed under the ISC License. For enterprise support or custom licensing, contact [email protected].
