Version: v0.7.0 - Beta.  We welcome contributors & feedback.

Session.addCounter

Session.addCounter($key) -> number

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