okgrow/meteor-persistent-session — pull request #5 by valZho (2014-06-17 20:27:35+00:00)
Title: Complete Overhaul

Completely overhauled the management of persistent session. There are now 3 spaces: temporary (matches current Meteor implementation), persistent (data is stored in localStorage until cleared), and authenticated (data is stored in localStorage until cleared AND is cleared automatically when a user logs out. Because you can now determine which variables to clear on logout at the time of their creation, I ditched the associated setting.

There is a new setting: default_method, which dictates which method to use when calling Session.set(). You can always specify exactly which method to save with (overriding the default_method) by using the appropriate method.

SETTING SESSION VARIABLES:
* Session.set(key, value) <--- store a session var according to the default_method
* Session.setTemp(key, value) <--- store a session var without persistence
* Session.setPersistent(key, value) <--- store a session var with localStorage
* Session.setAuth(key, value) <--- store a session var with localStorage and delete it when the user logs out

SET DEFAULT
all of the set() functions have a setDefault counterpart where the session var will only be created if one doesn't already exist. None of the setDefault() commands will change the type of an existing session var.
* Session.setDefault(key, value)
* Session.setDefaultTemp(key, value)
* Session.setDefaultPersistent(key, value)
* Session.setDefaultAuth(key, value)

CHANGE TYPES
Use these commands to change a session var into a particular type
* Session.makeTemp(key)
* Session.makePersistent(key)
* Session.makeAuth(key)

CLEAR VALUES
* Session.clear() <--- destroys all session vars of all types
* Session.clear(key) <--- destroys a single session var
* Session.clearTemp() <--- destroys all temp session vars
* Session.clearPersistent() <--- destroys all persistent session vars
* Session.clearAuth() <--- destroys all auth session vars

OTHER
These work the same as the current Meteor implementation
* Session.get(key)
* Session.equals(key, value)