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

c-monitor

v1.0.5

Published

简单的前端异常收集sdk

Downloads

20

Readme

前端错误收集 sdk(基础版)

  • 安装
yarn add c-monitor
or
npm install c-monitor
  • 新增功能点

    • 支持主动上报自定义日志,参数如下
    /**
     * 主动上报方法参数说明
     * params的值为:内置的js错误对象 || 自定义上报日志对象
     * 以下示例 伪代码,具体调用看文档下面的 三种引入方式
     */
    interface customParams {
      name: "custom_info";   // 自主上报日志name必填 custom_info
      message: string;       // 自主上报日志内容必填,且为字符串
      businessName?: string;  // 业务模块 名称
    }
    interface err {
      ......  // 内置的err对象不做参数说明
    }
    const data: customParams | err;
    CMonitor.notify(data);
  • 支持 browser、umd、esm 三种方式引入使用

  1. 在原生浏览器环境使用如下
<script src="./前端错误收集sdk"></script>;

// 初始化
CMonitor.init({
  disable: 1, // 1 为启用, 0 为关闭
  appkey: "xxxxxxx", // app唯一标识
  uploadUrl: "http://xxx.xxx.xxx", // 上报到server端的接口地址,目前server没有提供上报接口,默认搭配封装浏览器,写入本地log文件中
});
  1. 在 vue2 中使用如下
import Vue from "vue";
import CMonitor from "前端错误收集sdk";

// 初始化
CMonitor.init({
  disable: process.env.NODE_ENV === "production" ? 1 : 0, // 1 为启用, 0 为关闭   (可选择生产环境才开启)
  appkey: "xxxxxxx", // app唯一标识
  uploadUrl: "http://xxx.xxx.xxx", // 上报到server端的接口地址,目前server没有提供上报接口,默认搭配封装浏览器,写入本地log文件中
});

Vue.config.errorHandler = function (err) {
  CMonitor.notify(err); // 主动上报函数
};
  1. 在 vue3 中使用如下
import { createApp } from "vue";
import App from "./App.vue";
import CMonitor from "前端错误收集sdk";

const app = createApp(App);
// 初始化
CMonitor.init({
  disable: 1, // 1 为启用, 0 为关闭  (可选择生产环境才开启)
  appkey: "xxxxxxx", // app唯一标识
  uploadUrl: "http://xxx.xxx.xxx", // 上报到server端的接口地址,目前server没有提供上报接口,默认搭配封装浏览器,写入本地log文件中
});

app.config.errorHandler = (err) => {
  CMonitor.notify(err); // 主动上报函数
};

app.mount("#app");