Tracker.js一个javascript错误跟踪器

一个上传前端错误的小组件

JavaScript 其它杂项

访问GitHub主页

共55Star

详细介绍

Tracker.js

tracker.js is a samll component for uploading front-end-error.

Usage

First import tracker.js to head

<head>
	<script src="tracker.js" type="text/javascript"></script>
</head>

Then init tracker instance in the front of all script

<script>
	ErrorTracker.init(opts);
</script>

Options

Options is a json object with these params configuration

params type default description
report_url String null report request server url
method String post report request method
headers Object { 'Content-Type':'application/json' } request headers
callbackSuccess Function null callback after upload success
callbackFailed Function null callback after upload fail

Enjoy

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Tracker.js</title>
    <script src="tracker.js" type="text/javascript"></script>
</head>
<body>
<script>
    ErrorTracker.init({
        report_url: 'http://www.abc.com'
    });

    var f = window.testErrorTracker();
</script>
</body>
</html>
推荐源码