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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arms/rum-core

v0.1.13

Published

arms rum javascript sdk core

Readme

@arms/rum-core

ARMS RUM SDK 多端方案的核心抽象层,为各平台 shell(browser / uniapp / miniapp / minigame / electron / reactnative 等)提供统一的角色模型、事件协议与跨运行时工具。

角色模型

  • Client:装载并编排 Collector / Processor / Reporter,串联事件管线。
  • Context:运行时上下文,承载 config / session / views / emitter / identity。
  • Shell:对外 API 入口,提供 sendCustom / sendView / sendException / sendResource / sendAction / setUser 等。
  • Identity:业务身份状态机(产品分析),维护登录 / 匿名状态、属性操作折叠、匿名区间回填与 outbox 重发。
  • ConfigManager:本地+远端配置编排,支持 launch-first / remote-first 两种模式。
  • Collector / Processor / Reporter:平台扩展点,分别负责数据采集、加工、上报。

事件流:Collector → sendEvent → Processor 链 → Reporter(队列 / 合并 / 按会话与登录身份分组打包 / 重试) → Transport。

Shell 对外 API

| API | 说明 | | ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | | sendCustom(payload) | 自定义业务事件(name / type 必填) | | sendAction(payload) | 自定义行为事件(name 必填,超 100 字符截断;group / properties 可选) | | sendView(payload) | 自定义视图性能打点(type='custom' 时 t1 / t2 / t3 至少提供一个) | | sendException(payload) | 异常上报(接受 RumExceptionEvent \| Error,source 默认 'custom') | | sendResource(payload) | 资源 / 请求上报(name / type / duration 必填) | | startView(name, options?) | 手动开启 view(配合 trackViewsManually;同名去重,创建新 view 时结束上一个并上报 view 事件) | | setUser(user) | 登录 / 切换用户(name + properties / propertiesOnce) | | setUserProperties(props, propertiesOnce?) / unsetUserProperties(keys) | 身份属性补充 / 删除(未登录时暂存,登录时随身份事件一起上报) | | reset() | 退出登录(清除本地身份状态;匿名用户 ID 与当前会话不变) | | sendEvent(event, options?) | 底层事件入口(面向 shell / 高级用法);options.immediate 入队后立即 flush,options.single 独立打包上报 |

init 完成前的 setUser / sendAction 等 Shell 调用会被缓存(上限 50 条),init 完成后按调用顺序回放;身份事件不受会话采样影响(未命中采样的会话仅发送 identify 事件)。

关键工具(节选)

  • interceptFunction / restoreFunction:函数拦截支持多订阅共存——重复拦截同一方法仅追加订阅、不再嵌套代理,restoreFunction 可按订阅者逐个退订;支持 isPrototype 声明回调的 this 语义。
  • parseTracingContext / makeTracingHeaders:多协议 Trace 上下文解析与生成(traceparent / b3 / b3multi / jaeger / sw8),兼容 Headers 实例与普通对象、键名大小写不敏感。
  • parseActionProperties / verifyProperties:埋点属性解析与校验(key ≤ 50 字符、string 值 ≤ 2000 字符、单次 ≤ 20 项;可选 allowBoolean 支持布尔值)。

支持运行时

浏览器(ES2017+,不含 IE)、Node.js 16+、Deno、Bun、Electron、React Native 0.68+、微信/支付宝/字节小程序(基础库 2.10+ 同等能力)、uni-app 3.x。

core 自身不依赖任何浏览器或 Node 专属 API(window / document / fetch / localStorage / XMLHttpRequest 等);host API 通过 env/ 抽象由 shell 注入。

开发

npm run build    # 产出 lib/ (CJS) + es/ (ESM)
npm test         # 单元测试(先 build 后 test,重构后改为直接跑 ts 源码)