settings-manager v1.0.4
settings-manager
A facade for user settings repositories.
Introduction
This is intended as a generic interface to an asynchronous setting API. Using this library allows for abstraction of the underlying settings. This package was intended for plugin development in order to make plugins portable across platforms.
Setup
npm installBuilding
A build will check the source code and place code in the build\dist folder.
npm run buildTo run a build on source code changes:
npm run build:watchTo build distributable artifacts (which includes a minimized version as well as burning in build-time data):
npm run distRunning Tests
To run tests against the source code and dist folder (including coverage):
npm testTo run tests against the source code and dist folder (including coverage), with reload:
npm run test:watchBuild a Release
This is a basic script which can be used to build and deploy (to NPM) the project.
npm run releaseReleases to the NPM registry are handled by Travis CI. Pushing master to GitHub will trigger a build and deploy to the NPM registry. The release script will NOT push to the repository. When pushing, tags should be included:
git push --all && git push --tagsAPI
new SettingsManager(backing_store)
Creates a new SettingsManager instance. The optional backing store should implement the same API as SettingsManager, or have an adapter provided. With no backing store specified, an in-memory store will be used.
load(success)
Loads the settings. Takes a success callback and an error callback. The value passed into the settings callback represents the value from the backing store.
save(settings, success)
Saves the settings. Requires the settings to save and takes an optional callback for the success or error status.
clear(success])
Clears the settings. Takes an optional callback for the success or error status.