Version: v0.5.0 - 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 ...

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