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

quick-app-sdk

v1.0.0

Published

1. 安装tnpm

Downloads

6

Readme

开发环境搭建

  1. 安装tnpm

    npm install -g tnpm --registry=http://registry.npm.alibaba-inc.com

  2. 安装依赖

    npm install

  3. 打包

    npm run build

  4. 计算文件md5

    npm run md5

  5. 执行eslint检查

    npm run lint

模拟SDK下发服务

./server/server.sh

开发时为保证SDK请求正常执行,需要手动修改umengAnalysis.js文件中SdkUpdater类中的url配置为可用的服务器地址:

this.url = 'http://30.30.142.90:8200/checkversion.cjs';

问题思考

  1. 缓存版本问题
    • 版本需区分版本,在发送缓存数据时,应判断app当前版本与缓存版本是否一致,不一致应该丢掉
  2. 发送时机问题
    • 在启动或内存里事件达到5条时发送
  3. 补sessionid
    • 如果session的创建是个异步过程,则在session创建完成前,可能已经产生了事件,所以需要在pause函数内遍历一边内存 里的事件,为事件补上sessionid
  4. 异步问题(需验证)
    • 快应用的文件读写只提供了异步操作,在按home键app退到后台时,是否可以保证将数据成功写入storage

TODO

  1. 把sdk的两个文件封装为标准的npm包,简化快应用中的使用方法;
  2. uma_impl中require的模块需要在umenganalysis中注册;
  3. 代码使用storage保存,不是很理想;

Umeng SDK(快应用版)使用说明

  1. 在应用初始化文件中(app.ux)添加

    // 添加在 js 头部
    const uma = require('./umenganalysis');
    
    // app.ux onCreate方法中添加
    uma.init(this);
  2. 在相应的页面中添加

    // 添加在 js 头部
    const uma = $umeng_stat;
    
    // onHide,onShow方法中添加
    onHide() {
        console.log('Home::onHide');
        uma.pause(this);
    },
    onShow() {
        console.log('Home::onShow');
        uma.resume(this);
    }
    
    // 具体发送事件方式
    uma.trackEvent('test_event1', {
        'attr1': 123,
        'attr2': 'abc'
    });