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

swan-activity

v0.1.2-beta.1

Published

活动:分享有礼,收藏有礼

Readme

分享有礼

开发者接入

打开命令行工具,开发者使用npm包管理器获取组件代码包:

	# 进入小程序源代码跟目录,例如 /root/swan
	cd /root/swan
	# npm 安装分享有礼组件
    npm install swan-activity

在页面中引用分享有礼组件:

<!-- pages/index/index.swan -->
<view class="container">
	<!--bind:tap绑定分享方法,方法名是跟页面的配置对应的-->
    <view bind:tap="share">分享有礼</view>
    <view bind:tap="directShare">分享到朋友圈</view>
</view>

分享参数与小程序分享API相同,链接地址:https://smartprogram.baidu.com/docs/develop/api/open_share/#swan-openShare/

/**
 * @file page/index/index.js
 * @author swan
 */
const share = require('swan-activity/share');
Page({
    data: {},
    onLoad() {
        // 注册活动,例如活动ID为'1'
        share.init('1');
    },
    share() {
        // 触发分享面板
        // 关于分享参数可以查看API
        share.open({
            title: '这份瞎买清单是真的香!',
            content: '疯狂爆灯,抢到就值!',
            path: '/pages/index/index'
        });
    },
    directShare() {
		// 渠道分享,例如不调起分享面板,直接分享到微信朋友圈
        share.open({
            title: '这份瞎买清单是真的香!',
            content: '疯狂爆灯,抢到就值!',
            path: '/pages/index/index',
            // 分享渠道参数,可从分享API文档中获取详细说明
            mediaType: 'weixin_friend'
        });
	}
});

收藏有礼

开发者接入

开发者使用npm包管理器获取组件代码包:

	# 进入小程序源代码跟目录,例如 /root/swan
	cd /root/swan
	# npm 安装收藏有礼组件
    npm install swan-activity

安装成功后,在页面中引用收藏有礼组件

/**
 * @file page/index/index.js
 * @author swan
 */
const favor = require('swan-activity/favor');
Page({
    data: {},
    onShow() {
	    // 页面成功展示后
	    // 弹出收藏并领取积分弹窗,例如活动ID为'2'
        favor.open('2');
    }
});