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

tq-jczl4-bury

v1.0.5

Published

天阙-基层治理4-埋点

Downloads

14

Readme

tq-jczl4-bury

基层治理4平台埋点sdk,h5和pc共用

目录

使用

安装依赖

yarn add tq-jczl4-bury@latest

使用方法

import TQ_JCZL4_BURY, { BURY_TAGS, PLAT_FORM } from 'tq-jczl4-bury'

// 初始化埋点信息
TQ_JCZL4_BURY.init({
    platForm: PLAT_FORM.MOBILE, // 1 pc端 2 APP端
    systemLogo: 'jczl',
    orgId: _user.data.organizationId,
    orgLevel: _user.data.orgLevel,
    userId: _user.data.id,
    url: '/operating/audit', // 请求接口
    needCallBack: false,
})

// 推送埋点tag
TQ_JCZL4_BURY.pushTag(BURY_TAGS.APP.NAVIGATION.SY)

// 同步推送埋点tag
TQ_JCZL4_BURY.pushTagSync(BURY_TAGS.APP.NAVIGATION.SY)

// 异步推送埋点tag
TQ_JCZL4_BURY.pushTagAsync(BURY_TAGS.PC.NAVIGATION.SY).then(res => {
    console.log(res)
}).catch(err => {
    console.log(err)
})

结构

   +-- src ----------------------------------------------> 源码目录
   |   |
   |   +-- constants ---------------------------------------> 变量定义
   |   |   |
   |   |   +-- tags.tsx ---------------------------------------> 埋点tag
   |   |   |
   |   |   +-- plat_form.tsx ---------------------------------------> 平台类型
   |   |   |
   |   |   +-- index.tsx ---------------------------------------> 变量导出集合
   |   |
   |   +-- types ---------------------------------------> 类型定义
   |   |   |
   |   |   +-- index.tsx ---------------------------------------> 类型定义集合
   |   |
   |   +-- utils ---------------------------------------> 工具方法定义
   |   |   |
   |   |   +-- http.tsx ---------------------------------------> 接口请求工具
   |   |   |
   |   |   +-- store.tsx ---------------------------------------> 存储工具
   |   |   |
   |   |   +-- index.tsx ---------------------------------------> 工具导出集合
   |   |
   |   +-- index.tsx ---------------------------------------> 项目入口,方法统一集合
   |
   +-- package.json -------------------------------------> 项目信息/版本/npm脚本/依赖
   +-- README.md ----------------------------------------> 说明文档

需求分析

一、用户点击对应模块或功能,上传信息

1、需要上传的“模块或功能”,看 src/constants/tags.tsx 文件定义;
2、上传方法看使用方法

系统设计

一、用户点击对应模块或功能,上传信息

1、src/index.tsx 里,通过 TQ_JCZL4_BURY.init 初始化埋点信息,将埋点信息通过 StoreUtil.InitData 存储到 localStorage;

2、通过 TQ_JCZL4_BURY.pushTag(BURY_TAGS.PC.NAVIGATION.SY) 上传对应的埋点信息,会将存储的信息一并上传;

上传到npmjs

1、更改 package.json 里的 version 版本号 +1 ;
2、执行 yarn build 构建新包;
3、执行 nrm use npm ,切换环境到 npm ;
4、执行 npm login ,账号:? 密码: ? 邮箱:? ;
5、需要输入邮箱验证码;
6、执行 npm publish , 上传版本包;
7、执行 nrm use tianque 切换环境;
8、若在 yarn add tq-jczl4-bury@latest,安装最新版本时没有新版本包时,可以到淘宝镜像地址 https://npmmirror.com/,搜索包名,点击 sync 同步;

更新

2022-09-01

1、提供同步 pushTagSync 和异步 pushTagAsync 埋点方法;
2、获取存储 StoreUtil.get() 方法里,对于 storeInfo 设置默认值 {},防止未初始化进行埋点时报错;
3、版本更新 1.0.4 ;