https://github.com/xlsdg/bug-reporter
A pure JavaScript library handle report error message
https://github.com/xlsdg/bug-reporter
javascript javascript-library leancloud library
Last synced: about 2 months ago
JSON representation
A pure JavaScript library handle report error message
- Host: GitHub
- URL: https://github.com/xlsdg/bug-reporter
- Owner: xlsdg
- License: mit
- Created: 2016-12-31T12:49:17.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-18T07:39:39.000Z (over 8 years ago)
- Last Synced: 2024-12-31T04:02:22.303Z (5 months ago)
- Topics: javascript, javascript-library, leancloud, library
- Language: JavaScript
- Homepage:
- Size: 271 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bug-reporter
> A pure JavaScript library handle report error message
## Installation
``` bash
$ npm install --save bug-reporter
```## Usage
使用 LeanCloud 或 自备后台服务器接口 (可同时一起使用)保存 Bug 信息。
``` html
window.bugReporter.init({
url: '/bug/reporter',
type: 'post',
success: function(text) {
console.log(text)
},
fail: function(req) {
console.error(req);
}
});
```or
``` js
```
## Options
* `appId` **[String]**
LeanCloud App ID
* `appKey` **[String]**
LeanCloud App Key
* `appClass` **[String]**
LeanCloud Data Class
* `debug` **[Boolean]**
`false` by defualt.
* `output` **[Boolean]**
`false` by defualt.
* `url` **[String]**
* `type` **[String]**`GET` by defualt.
* `success` **[Function]**
* `fail` **[Function]*** `window` **[Array]**
`[]` by defualt.
* `navigator` **[Array]**
`['language', 'platform', 'userAgent']` by defualt.
* `screen` **[Array]**
`['width', 'height']` by defualt.
## Methods
* `init`
``` js
@param {Object} opts - bugReporter options
```* `destory`
* `report```` js
@param {String} method - 'GET' or 'POST' or 'JSON'
@param {String} url
@param {Object} data
@param {Function} cbSucs - success callback
@param {Function} cbFail - fail callback
```* `sendData`
``` js
@param {Object} data
```* `wrap` **[A generic wrapper utility function]**
``` js
@param {Function} fn
```* `invoke` **[which calls a function on an object with an array of arguments]**
``` js
@param {Object} obj
@param {Function} method
@param {Array} args
```# License
MIT