Skip to content

Latest commit

 

History

History
90 lines (66 loc) · 1.86 KB

README.md

File metadata and controls

90 lines (66 loc) · 1.86 KB

@configu/browser

Configu SDK for the Browser

Install

To install the this package, simply type add or install @configu/browser using your favorite package manager:

npm install @configu/browser
yarn add @configu/browser
pnpm add @configu/browser

Or include it in your main html as a script tag:

<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';

(async () => {
  try {
    const store = new LocalForageConfigStore({ name: 'config-db' });
    const set = new ConfigSet('test');
    const schema = await ConfigSchema.init(); // pick get-started.cfgu.json

    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({
      data,
    }).run();
  } catch (error) {
    console.error(error);
  }
})();

Reference

See oss.configu.com/browser

Contributing

Requirements

  1. Follow the Development section from the CONTRIBUTING.md.

Setup

Run these commands in order:

cd ts
npm install

Contribute

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