Install

npm install @configu/browser
yarn add @configu/browser
pnpm add @configu/browser
<script src="https://unpkg.com/@configu/browser/dist/configu.min.js" charset="utf-8"></script>

Usage

import {
  LocalForageConfigStore,
  ConfigSet,
  ConfigSchema,
  UpsertCommand,
  EvalCommand,
  ExportCommand,
} from '@configu/browser';
import schemaContents from './start.cfgu.json';

(async () => {
  try {
    const store = new LocalForageConfigStore({ name: 'config-db' });
    const set = new ConfigSet('test');
    const schema = new ConfigSchema('start', schemaContents);

    await new UpsertCommand({
      store,
      set,
      schema,
      configs: {
        GREETING: 'hey',
        SUBJECT: 'configu browser sdk',
      },
    }).run();

    const data = await new EvalCommand({
      store,
      set,
      schema,
    }).run();

    const configurationData = await new ExportCommand({
      pipe: data,
    }).run();
  } catch (error) {
    console.error(error);
  }
})();

Reference

See interfaces/sdk/browser/globals.

Contributing

Requirements

Follow the Development section from the CONTRIBUTING.md.

Setup

Run these commands in order:

pnpm install

Contribute

Follow the Sending a Pull Request section from the CONTRIBUTING.md.