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

lts-mini-sdk

v1.0.24

Published

lts-mini-sdk

Downloads

6

Readme

lts-mini-sdk

支持平台

  1. 百度小程序
  2. 微信小程序
  3. 钉钉小程序
  4. 支付宝小程序
  5. 快应用(1.0.23版本新增)

数据采集

  1. 安装依赖包
npm install --save lts-mini-sdk
  1. 引入依赖模块
// 小程序引入
// CJS
const miniAgent = require('lts-mini-sdk').default;
// ESM
import miniAgent from 'lts-mini-sdk';
// 快应用引入
// CJS
const miniAgent = require('lts-mini-sdk/quick-app').default;
// ESM
import miniAgent from 'lts-mini-sdk/quick-app';
  1. 配置参数
const miniParam = {
  groupId: '', // 必填  LTS日志组ID
  projectId: '', // 必填  标识LTS所处的projectId
  region: '', // 必填  标识上报LTS所处的region
  streamId: '', // 必填  LTS日志流ID
  debug: 'OFF', // 选填,字符串或布尔类型,表示控制台调试信息输出等级,DEBUG\INFO\WARN\ERROR\OFF(此为从高到底排序)五个等级,默认为OFF,值为true时开启DEBUG等级的日志,值为false时则为OFF 
  cacheThreshold: 30, // 选填 上报条数阈值
  platform: '', // 选填 标识小程序平台,baidu:百度小程序(默认),wx:微信小程序,dd:钉钉小程序,my:支付宝小程序,quickApp:快应用
  timeInterval: 3, // 选填 上报时间间隔,1.0.4版本之前为timeThreshold,之后的版本兼容,在timeThreshold和timeInterval同时存在时以timeInterval为准
  url: '', // 选填 自定义上报地址
};
  1. 初始化
const mini = new miniAgent(miniParam);
  1. 上传日志
// 缓存上报
mini.report({
  id: '',
  name: '',
});

// 立即上报
mini.reportImmediately({
  id: '',
  name: '',
});

功能介绍

report(content,labels)

说明: 采集日志,缓存到本地,当缓存条数达到阈值时,自动上报。 content参数: Object类型,支持json和array。 labels参数: 非必填,支持json。

reportImmediately(content,labels)

说明: 采集日志,立即上报。 content参数: Object类型,支持json和array。 labels参数: 非必填,支持json。

版本更新说明

1.0.24

1.新增广州、上海一、上海二等12个region的支持。

1.0.23

1.新增对快应用的支持。

1.0.21

1.删除代码中出现的中文,去除代码中对三方包的引入。

1.0.20

1.废弃config方法,优先使用new SDK创建一个新的实例。

1.0.19

1.修改时间阈值的范围从1-60改为1-1800,其默认值从30改为3。

1.0.18

1.调整日志级别等级。 2.支持labels嵌套。

1.0.15

1.新增多实例。