0.1.7 • Published 7 years ago
bug-reporter v0.1.7
bug-reporter
A pure JavaScript library handle report error message
Installation
$ npm install --save bug-reporter
Usage
使用 LeanCloud 或 自备后台服务器接口 (可同时一起使用)保存 Bug 信息。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="/path/to/bugReporter.min.js"></script>
<script type="text/javascript">
window.bugReporter.init({
url: '/bug/reporter',
type: 'post',
success: function(text) {
console.log(text)
},
fail: function(req) {
console.error(req);
}
});
</script>
</head>
<body>
</body>
</html>
or
<script src="//unpkg.com/bug-reporter/lib/bugReporter.min.js"></script>
Options
appId
StringLeanCloud App ID
appKey
StringLeanCloud App Key
appClass
StringLeanCloud Data Class
debug
Booleanfalse
by defualt.output
Booleanfalse
by defualt.url
Stringtype
StringGET
by defualt.success
Functionfail
Functionwindow
Array[]
by defualt.navigator
Array['language', 'platform', 'userAgent']
by defualt.screen
Array['width', 'height']
by defualt.
Methods
init
@param {Object} opts - bugReporter options
destory
report
@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
@param {Object} data
@param {Function} fn
@param {Object} obj
@param {Function} method
@param {Array} args
License
MIT