API
Vue.ls.get(name, def)
Returns value under name
in storage. Internally parses the value from JSON before returning it.
def
: default null, returned if not setname
.
Vue.ls.set(name, value, expire)
Persists value
under name
in storage. Internally converts the value
to JSON.
expire
: default null, life time in millisecondsname
Vue.ls.remove(name)
Removes name
from storage. Returns true
if the property was successfully deleted, and false
otherwise.
Vue.ls.clear()
Clears storage.
Vue.ls.on(name, callback)
Listen for changes persisted against name
on other tabs. Triggers callback
when a change occurs, passing the following arguments.
newValue
: the current value forname
in storage, parsed from the persisted JSONoldValue
: the old value forname
in storage, parsed from the persisted JSONurl
: the url for the tab where the modification came from
Vue.ls.off(name, callback)
Removes a listener previously attached with Vue.ls.on(name, callback)
.