1.3.1 • Published 4 years ago

catch-global-error v1.3.1

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

catch-global-error ( web )

devtools(vConsole)、upload error、monitoring logs

Use

npm install catch-global-error --save
// or
yarn add catch-global-error
import CatchError from 'catch-global-error';

const catchError = new CatchError();
catchError.init({
  url: '/api/error/log', // upload error site
});
const a = 1;
console.log(a.b.c);

Method

init(config)

initialize

options parameter

paramdescriptiontypevaluedefault value
urlthe site of uploading errorString--
methodthe method of uploading errorStringget/postpost
showDevtoolsshow devtoolsBooleantrue/falsefalse
urlSwitchurl query for devtoolsObject-{ devtools: 'show' }
cdnvConsole cdnString-'https://res.wx.qq.com/mmbizwap/zh_CN/htmledition/js/vconsole/3.0.0/vconsole.min.js'
extendFieldsadd extend field about business or project what you want to send to the service, such as business_line, typeObject--

show()

show devtools

Demo of devtools

1. bashowDevtools = true

// 1: init
import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init({
  showDevtools: true, // default show Devtools
});

2. url query

// default: www.***.com?devtools=show
// you can change url query switch

// eq: www.***.com?show=test
import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init({
  urlSwitch: {
    show: 'test',
  },
});

3. catchError.show

import CatchError from 'catch-global-error';
const catchError = new CatchError();
catchError.init();

window.onclick = () => {
  catchError.show();
};

LICENSE

MIT

1.3.1

4 years ago

1.3.0

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago