@sizzle/remote-config
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

remote-config

Remote configuration that is either fetched or cached locally for your React Native app or PWA

Config is used as a browser/embedded utility to provide auto refreshing remote configuration with local persistance and caching.

Persistance is disabled by default. To enable it - provide it in the constructor.

Example of usage

const path = 'https://raw.githubusercontent.com/sizzlehq/remote-config/master/package.json';
const headers = { 
  'Authorization': 'Bearer 9145221F-F8F9-4A5C-8487-1EBA74386877'
};

const defaultConfig = {
  key: 'value'
};

(async (): Promise<void> => {
  let config;

  try {
    config = new Config(defaultConfig, path, {
      storage: localStorage,
      headers: headers
    });
    await config.fetch();
  } catch (err) {
    throw new Error(`couldn't fetch config - ${err}`);
  }

  config.autoRefresh();
  const repType = config.value('repository.type'); // "git"
});

Readme

Keywords

none

Package Sidebar

Install

npm i @sizzle/remote-config

Weekly Downloads

2

Version

1.1.1

License

MIT

Unpacked Size

27.8 kB

Total Files

12

Last publish

Collaborators

  • dv-bv