reim-reporter

import reporter from 'reim-reporter'

reim-reporter is a Reim plugin that executes on setState / set

It is useful for updating analytics data e.g. Google analytics

Exports

reporter

reporter(callback: func) => func

Usage

const store = reim({}).plugin(reporter(meta => {
    console.log('will report meta!')
    // pass to analytics
}))

It subscribes to setState event, and will call callback as

callback(
    {
        name, // mutation name
        snapshot, // current state snapshot
        payload, // args passed into mutation
    },
    store // Reim store
)

Last updated