Skip to content

cesarve77/persistent-reactive-var

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Reactive local storage between tabs

Install

$ meteor add cesarve:persistent-reactive-var

Usage

/***
* create new var
* take to params
* uniqueId required: an unique string foe each new persistent var
* defaultValue: a initial value if the storage var does not exist (no accept functions)
*/
foo= new PersistentReactiveVar(uniqueId: String,defaultValue: Any)
// example foo=PersistentReactiveVar('MyUniqueString',{a:1})


/***
* set value
* take 2 params
* value
* expire in milliseconds or null for no expire 
*/
foo.set({foo:'bar'},expire)
// example foo=set({a:2},1000*60*60*24)

/***
* get storaged value
* take no params
* return Any value
*/
foo.get()

/***
* set an initial value
* take one param
* val Any value
*/
foo.setDefault(val) 

//clear var
foo.set(undefined)

Very simple api, tiny footprint just (use amplify behind the scene)

Licence MIT

About

Persistent reactive var for meteor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published