Reim
Github
2.0.0
2.0.0
  • Reim.js
  • Introduction
    • Motivation
    • Concepts
  • Guide
    • Store
    • setState
    • Subscribe
    • Plugin
    • Event Emitter
    • Use with React / Preact
    • Use with Vue
    • Use with Angular / Rxjs
  • Ecosystem
    • react-reim
    • reim-task
    • reim-reporter
    • reim-persist
    • Release Notes
Powered by GitBook
On this page
  • Exports
  • reporter
  1. Ecosystem

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
)

Previousreim-taskNextreim-persist

Last updated 6 years ago