
Meteor Cookbook
By :

The Session object is a global client-side object, and as such, is part of the client model. Though it's not part of any collection, the Session object can be used in a reactive context, which means you can use it to make reactive methods rerun whenever it is changed. This recipe will show you how to use the Session object to update the elements on your page.
You will need to have Meteor installed and a project created. To create a standard project file structure, please see the Setting up your project file structure recipe in Chapter 1, Optimizing Your Workflow. A quick default project will work just as well for this recipe.
To use the Session object, proceed with the following steps:
main.js
file in your client's scripts
folder ([project root]/client/scripts/main.js
) and add a greeting
helper to the beginning of Template.hello.helpers
, as follows:Template.hello.helpers({ greeting: function() { return Session.get...
Change the font size
Change margin width
Change background colour