npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

skyeye-sdk

v0.4.6

Published

实时监控前端JavaSript应用的错误,助您提升用户体验

Downloads

9

Readme

错误监控插件

实时监控前端JavaSript应用的错误,助您提升用户体验

安装

npm install skyeye-javascript

使用

import Skyeye from "skyeye-javascript";
const error = new Skyeye({
    isProd: true,// 分测试和正式环境
    client: '', // 客户端id(必填)
    page: '', // 页面标识(非必填)
    url: ''// 错误日志发送地址 非必填)支持代理转发,
    ignoreResource: false, // 过滤资源报错
    ignore: [],// 忽略指定报错-正则匹配
    openTraceLog: false,// 开启行为追踪
    traceLimit: 50 //本地行为步骤最多记录次数
})

window.$error = error

window.$error.ajaxError(response) // 支持接口自定义报错 - response为axios返回拦截器回调参数
data = {}
// 根据报错类型对应的错误对象不同  
1. 请求报错
data = {
    target: 'ajaxError',
    type: 'RequestError',
    method: '',// 接口方法
    data: {},// 接口参数
    status: 200,
    statusText: 'ok',
    headers: null, // 接口响应头
    msg: '',// 接口报错信息
    file: location.href, //请求报错url
    page: location.href,// 出现错误的页面
    errorKey: '',// 错误的唯一标识
}
2.js报错
const ErrTypeReg = /Uncaught\s(\S*):/i;
const type = e.message.match(ErrTypeReg);
data = {
    target: 'scriptError',// js报错(必填)
    type: '',// js错误类型(必填) 常见js错误 SyntaxError, ReferenceError,RangeError, TypeError, unknown等
    msg: '',// 错误信息,
    file: '',// 文件名称,
    line: '',// 文件错误行,
    col: '',// 文件错误列
    page: '',// location.href,
    errorKey:'' //错误的唯一标识
}
widnow.$error.sendApi(data) // 自定义报错  

如应用未使用axios作为ajax框架,不能全局拦截报错,需要用户手动发送接口报错  

let errObj = {
    target: 'ajaxError',
    type: 'RequestError',
    method: 'post',
    data: {},
    status: 200,
    statusText: 'ok',
    headers: 'content-type: application/json',
    msg: '{"code":50001,"message":"成员不存在, organId:f623e964316a43b78f7b725f92e45f98, memberAccountUid: 89eb2f7439b745fab561a15132a615fe ","data":null}',
    file: requestUrl,
    page: location.href,
    errorKey: 999,
}
widnow.$error.sendApi(errObj)