Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

configry

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

configry

Javascript configuration library to handle an application's configuration. Stores config to localstorage.

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

Configurator is a config manager library for Javascript. It uses localStorage to store persistent configurations in the browser.

##Setup

Include configurator.js in your html

<script src="configurator.js"></script>

Now, create a config object. The function takes two parameters :

  1. default: Object holding default configuration values
  2. persistent: Array of key strings for persistent configuration.
var config= Configurator({sound:true,autoPlay:false,volume:60},['volume']);

//volume property will persist even after refreshes using localstorage.

//Set additional configuration options

config.set("shuffle",true,true);

.set takes three parameters:

  1. Key Name
  2. Value
  3. Persistent (true/false)
var shuffleState = config.get('shuffle');
//Will get the value of the config option.

###Localstorage clearing Since configurator stores the persistent config information in localstorage, you cannot clear localstorage using localStorage.clear any more. Instead use config.clearLS() function to clear the localStorage. It will clear localstorage, and write the persistent config keys back into localStorage.

#Licence Licenced under MIT Licence. Feel free to fork/use.

Configurator is extracted from SDSLabs Muzi, a music player application for the IIT-Roorkee Campus.

Keywords

FAQs

Package last updated on 18 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc