1.0.3 • Published 3 years ago

@wonoly/settings v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

settings (1.0.3)

A settings npm package for making settings storage easy.

Instalation

To install you will need:

  • node / npm
$ npm i @wonoly/settings

Usage

You will need to run this package in the client side, since it needs the localStorage API.

import { Settings } from '@wonoly/settings';

var settings = new Settings()

settings.loadSettings() // Will create settings if needed
let s = settings.settings

console.log(s)

This console.log will return a dictionary with the current settings.

{
    "theme": "light",
    "units": "metric",
    "link": {
        "newtab": false
    },
    "usage": {
        "activity": true,
        "feedback": true,
        "queryCount": true,
    },
    "results": {
        "country": "all",
        "safeSearch": 1,
        "time": "any"
    }
}

Other exports

You can also export the following objects.

  • template - Template settings
  • timeRanges - time ranges for search results
  • countries - countries for search results {name, code}
1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago