@coffeekraken/s-config-adapter
Base class to use to create config adapters like the @coffeekraken/s-config-folder-adapter.
Install
npm i @coffeekraken/s-config-adapter
SConfigAdapter
This package expose a simple SConfigAdapter
class that has to be used as base when creating an SConfig adapter.
Features
- Provide an
update
method to call when some configs has been changed.
- And more...
Usage
Here's a simple example how to use the SConfigAdapter class:
import __SConfigAdapter from '@coffeekraken/s-config-adapter';
import type { ISConfigAdapterLoadParams } from '@coffeekraken/s-config-adapter';
class MyConfigAdapter extends __SConfigAdapter {
constructor() {
super({
some: 'settings',
});
myCoolLiteneingFunction(() => {
this.update();
});
}
async load(params: ISConfigAdapterLoadParams): Promise<any> {
return {
my: 'config',
};
}
}
const myConfig = new __SConfig('my-config', new MyConfigAdapter());
myConfig.get('my');
API
For more information about the API, please check out the API documentation
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Here's all the ways you can contact us listed: