Reputation: 11125
Although I started using Meteor extensively only recently, the name "Session" for a Session
object in Meteor feels like a misnomer to me. It is very different from how it's conventionally used across the web and I don't understand why it's named that way. Is there a specific reason to this or is it possible to rename it to something more suitable?
Upvotes: 0
Views: 56
Reputation: 64342
A Session
variable is a reactive data source which:
I agree that the name is confusing because of the last point. To answer your question, yes you could name it something else if you really wanted to. For example:
NotReallySession = Session;
Then elsewhere in your client code, you could do:
NotReallySession.set('answer', 42);
NotReallySession.get('answer');
However, I'm not sure what you really gain by doing this.
A more attractive solution would be to use a package like persistent-session which modifies the Session
api to give you persistence across page refreshes by keeping values in localstorage.
Of particular interest may be the Session.setAuth
function, which stores a persistent reactive value which is cleared on logout. In my view, this most closely aligns with the notion of "session" from other contexts.
Upvotes: 2