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

cfloggerjs

v1.0.12

Published

<!-- * @Descripttion: * @version: * @Author: Do not Edit * @Date: 2022-02-28 09:44:30 * @LastEditors: 王珅 * @LastEditTime: 2023-02-13 15:51:54 -->

Downloads

27

Readme

说明

该 js 包为前端通用包,兼容各种代码框架

功能

提供封装的 api,以简便的方式对前端系统中的各种交互操作进行捕获,并上报到日志系统。目前可以全局自动捕获的功能包括:

  1. 单击事件上报

半自动的功能包括:

  1. 图层操作事件上报

其余功能可以通过手动上报 api 自行在代码中集成,实现上报功能,具体使用方法参见下方

使用

安装命令

执行命令 npm install cfloggerjs

初始化


var log = new cfloggerjs.Logger({
    // 必须传
    // send_url 日志接口地址
    send_url: '日志接口地址',
    // dom 过滤器,在这里面的 dom 类型才监听
    dom_selector: ['button', 'radio', 'input', 'select'],
    // 运维配置系统accesstoken,与下面的user_sha和app_code互斥
    identify_token:''
    // 用户登录后获取的 accessToken
    user_sha: 'accessToken(来自城方平台登录接口)',
    // 应用 id
    app_code: '',
    // 可以不传
    // 以下皆为默认值
    // 日志接口类型,不同类型对应不同的接口参数组织方式,目前只有 default(大部分用 default,其他类型如果有的话业也只是为兼容部分特殊的情况)
    url_type: 'default',
    // 是否集成上报 sdk,快捷的方式提供临时的开关
    default_integrations: true,
    // 日志上报的最低条数限制
    limit_length: 20,
    // 日志上报的最大时间限制
    limit_time: 10000,
    // 是否监听 http 错误
    http_error_catch: true
});

通用上报

// 上传到日志接口的 body 参数,具体结构依据后台配置提供,不固定
var body = {
    "Code": "",
    "Content": { }
}
log.queueManage(body);

其他设置

手动强制上传日志记录

// 可以在页面关闭前调用,避免操作记录丢失
log.uploadLog();

手动停止检查日志上报

// 重复实例化前可以通过该命令实现销毁,避免重复监听
log.stopCheck();

图层操作监听

/**
 * {operation} 包含'open' | 'close' | 'moveup' | 'movedown' | 'opacity'5 个值,分别对应图层的打开、关闭、上移、下移和透明度调整
 * {layerId} 图层 id
 * {layerName} 图层名
 * */
log.mapLayerListener('operation', 'layerId', 'layerName');