toggle-api
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

CircleCI npm version

Javascript ToggleAPI Client

A javascript client library for ToggleAPI.

Usage

This package provides a node compatible CommonJS build in the root and a concatenated UMD build in bundles/.

This package provides typescript definitions.

All examples are in ES6.

import { UserToggles } from 'toggle-api';

// (host, credentials, user_id, [anonymous], [app_version])
toggle = new UserToggles('http://api.toggleapi.com', 'server-api-key', 'userId', '2.0.1', false);

toggle.load().then(() => {
    // (toggle_id, default_value)
    if (toggle.getToggle('my-toggle', false)) {
        console.log('Enabled!');
    } else {
        console.log('Disabled!');
    }
});

Build

This project can be built using: npm run build

Test

This project can be tested using: npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i toggle-api

Weekly Downloads

3

Version

0.0.6

License

MIT

Last publish

Collaborators

  • squirly