Version: v0.6.1 - Beta.  We welcome contributors & feedback.  THanks!

Session.addCounter

Session.addCounter($key)

Description

Increment a counter for the given key.

If the key does not yet exist, it is initialized with the value of 1.

The current counter value is returned.

Session.addCounter('numPageHits');
Session.get('numPageHits');  //= 1

// ... in a later request ...

$numPageHits = Session.addCounter('numPageHits');
//= 2