Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@asayerio/tracker-mobx

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asayerio/tracker-mobx

Tracker plugin for MobX events recording

latest
npmnpm
Version
5.7.0
Version published
Maintainers
3
Created
Source

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).

Keywords

mobx

FAQs

Package last updated on 15 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts