Socket
Socket
Sign inDemoInstall

femonitor-wx

Package Overview
Dependencies
4
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    femonitor-wx

A SDK for wx miniprogramme error and performance report


Version published
Maintainers
1
Install size
484 kB
Created

Readme

Source

Description

A SDK for wx miniprogramme error and performance monitor, using event subscription.

Feature

  • Error observe, includes js error, unhandle rejection error and http error
  • Error filters and error sampling
  • Slow http request observe
  • Observe user behaviors into a behavior queue
  • Performance observe for every page

Install

NPM

npm i femonitor-wx -S

Directly download

Click here to dowload femonitor-wx sdk

Usage

const { Monitor } = require("femonitor-wx");

/* Options could be undefined because SDK has default options  */
const monitor = Monitor.init(options);

/* Listen all event */
monitor.on("event", (eventName, emitData) => {
  /* Use wx.request to report data here  */  
  console.log(eventName, emitData);
});

DefaultOptions

Options param will be deepmerge into defaultOptions

export const defaultOptions = {
  env: Env.Dev,   
  isSystemInfo: true,  // If get system info
  isNetwork: true,     // If get network info
  httpTimeout: 0,      // Define slow httptimeout(ms)
  error: {
    filters: [],       // Filter error using regexp array
    random: 1          // Extract error samples, 1 is 100%
  },
  behavior: {
    isFilterConsole: false,  // If record console behavior
    queueLimit: 20,          // Limit behavior queue to 20
    // Observe function name includes methodWhilteList, priority is higher than methodBlackList
    methodWhiteList: [],
    // Observe function name excludes methodBlackList
    methodBlackList: []
  },
  performance: {
    watch: true,       // If watch page performance
    queueLimit: 20     // Limit performane queue to 20
  }
};

Support events

EventNameDescription
jsErrorapp.onError
unhandleRejectionapp.onunhandledrejection
reqErrorNetwork request error
performanceInfoReadyPage performance data is ready
slowHttpRequestEmit when http request cost time larger than timeout httpTimeout
eventEmit for all events above

Development

npm run watch

Build

npm run build

Keywords

FAQs

Last updated on 04 May 2021

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc