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

wind-scale-miniprogram

v1.0.10

Published

一个用于微信小程序的电子秤核心包

Downloads

2

Readme

wind-scale-miniprogram

一个用于微信小程序的电子秤核心包

1.安装

// 1. 在小程序开发工具

npm install wind-scale-miniprogram --save

// 2. 小程序开发工具选择 [工具] -> [构建npm]

不错的教程👇🏻👇🏻👇🏻

微信小程序如何引入npm包?

2.使用

// $fxWeight为蓝牙电子秤实例
import { $fxWeight } from 'wind-scale-miniprogram'

2.1 蓝牙电子秤初始化 --- init

// 失败会自动提示蓝牙未开启
$fxWeight.init().then(res => {
    // 蓝牙开启成功
})

2.2 静默连接 --- silentConnect

// 会自动连接上次连接的电子秤
$fxWeight.silentConnect()

2.3 扫描电子秤 --- scanWeight

// 扫描电子秤, 每当扫描到新的电子秤信息会触发findWeightFn内的回调
$fxWeight.scanWeight().then(({ devicesList, findWeightFn }) => {
    this.setData({
        deviceList: devicesList,
        searchState: true,
        connectDeviceId: ''
    })
    findWeightFn(devices => {
        this.setData({
            deviceList: devices
        })
    })
})

2.4 停止扫描电子秤 --- stopScanWeight

$fxWeight.stopScanWeight().then(() => {
    this.setData({
        searchState: false
    })
})

2.5 连接电子秤, 以及订阅秤的信息 --- connectionWeight && notifyWeight

$fxWeight.connectionWeight(deviceId, name).then(() => {
	$fxWeight.notifyWeight(value => {
		// type 称重类型
		// weight 重量
		// tare 去皮标记
		// zero 置零标记
		switch (value.type) {
		// 稳定称重
		case 'stable':
			this.setData({
				weight: value.weight,
				tareFlag: value.tare,
				zeroFlag: value.zero
			})
			break
		// 不稳定称重
		case 'unstable':
			this.setData({
				weight: value.weight
			})
			break
		// 去皮
		case 'tare':
			this.setData({
				tareWeight: value.weight
			})
			break
		// 置零
		case 'OkStable':
			this.setData({
				weight: value.weight,
				tareFlag: value.tare,
				zeroFlag: value.zero,
				tareWeight: 0
			})
			console.log('设置置零成功')
			break
		// 去皮
		case 'OKTare':
			this.setData({
				tareWeight: value.weight
			})
			console.log('设置去皮成功')
			break
		case 'OK':
			console.log('设置成功')
			this.setData({
				tareWeight: 0
			})
			break
		}
	})
}).catch(() => {
    this.setData({
        connectDeviceId: ''
    })
})

2.6 断开电子称的连接 --- closeWeight

$fxWeight.closeWeight(deviceId).then(() => {
    // .....
})

2.7 获取电子秤连接状态 --- getDeviceConnect

$fxWeight.getDeviceConnect()

2.8 获取已经扫描过的设备列表

$fxWeight.getDevicesList()

2.9 获取电子秤扫描状态

$fxWeight.getScanState()

2.10 发送去皮指令

$fxWeight.sendTareCode().then(res => {
})

2.11 发送置零指令

$fxWeight.sendZeroCode().then(res => {
})

2.12 订阅电子秤连接状态变更信息

$fxWeight.notifyWeightConnectStateChange(this, res => {
    // res.connected [boolean] 连接状态
    // res.deviceId [string] 设备id
    // res.deviceName [string] 设备名称
})

2.13 开启调试

$fxWeight.openDebug()