Skip to content

Meteor package for local storage with reactive var and dict.

License

Notifications You must be signed in to change notification settings

Xerdi/meteor-local-storage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Meteor Local Storage

Local Storage helpers for Meteor with ReactiveVar and ReactiveDict.

Installation

Add the package to your project:

meteor add xerdi:local-storage

Usage

The package exports three classes which can be used similarly.

import {LocalStorage, LocalVarStorage, LocalDictStorage} from 'xerdi:local-storage';

const defaults = {
    a: true,
    b: 5,
    c: 'text'
};

export const mySettings = new LocalDictStorage('mySettings', defaults);

API

Both LocalVarStorage and LocalDictStorage extend from LocalStorage.

LocalStorage

  • constructor Takes a storage key and an object with default values.
  • get() Gets the stored values.
  • set(keyOrObject, value) Either gets an object for setting all values or a key and value to set.
  • unset(key) Only works for LocalDictStorage and removes the given key from the dictionary.
  • setDefault() Sets all values to their default value.
  • clear() Wipes the stored data.

About

Meteor package for local storage with reactive var and dict.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published