This package has been deprecated

Author message:

This package is no longer maintained. Please, use @openreplay/tracker and @openreplay/tracker-mobx instead.

@asayerio/tracker-mobx

5.7.0 • Public • Published

Asayer Tracker MobX plugin

A MobX plugin for Asayer Tracker. This plugin allows you to see the MobX events during session replay.

Installation

npm i @asayerio/tracker-mobx --save

Usage

Initialize the @asayerio/tracker package as usual and load the plugin into it. Then put the generated middleware into your Redux chain.

import Tracker from '@asayerio/tracker';
import trackerMobX from '@asayerio/tracker-mobx';

const tracker = new Tracker({
  projectID: PROJECT_ID,
});

tracker.plugin(trackerMobX());

This plugin is inspired by mobx-logger, hence it has similar configurations.

The default configurations are following

trackerMobX({
  predicate: () => true,
  action: true,
  reaction: true,
  transaction: true,
  compute: true
})

You can disable logging for actions and computed properties by providing a static trackerMobXConfig. This is useful to protect the private user data and keep your logs clean.

Here's an example of how to disable logging for all actions and computed properties for a given class:

class MyModel {
  static trackerMobXConfig: {
    enabled: false
  };

  // ...
}

Alternatively you can disable logging for particular class methods:

class MyStore {
  static trackerMobXConfig: {
    methods: {
      myAction: false
    }
  };

  @action myAction() {
    // calls to this method won't be logged
  }
}

You can combine the above examples to whitelist certain actions for being logged:

class MyStore {
  static trackerMobXConfig: {
    enabled: false,
    methods: {
      myAction: true
    }
  };

  @action myAction() {
    // only calls to this method are being logged
  }

  // other methods won't be logged ...
}

Please keep in mind that at this point trackerMobXConfig is only available for actions (@action) and computed properties (@computed).

Dependents (0)

Package Sidebar

Install

npm i @asayerio/tracker-mobx

Weekly Downloads

1

Version

5.7.0

License

MIT

Unpacked Size

30.4 kB

Total Files

28

Last publish

Collaborators

  • estradino