Session doesn't work


#1

Hello

I define session in my project but it doesn’t work and I keep getting this error in console:
session is not defined.

Here is my code:

 Template.leaderboard.events({
        'click.player': function () {
          
            var playerId = this._id;
            Session.set('selectedPlayer', playerId);
                  }
    })

Can you please let me know what is wrong?

thanks
Saeed


#2

How did you “define session in my project”?

Did you try meteor add session?


#3

You mean which I used is wrong and is not supported any more and i should use meteor add session function?


#4

Session is a package. It needs adding (with meteor add session) before it can be used.