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

applets-ble

v1.1.1

Published

uniapp 和 微信小程序蓝牙连接核心操作封装模块处理,可快速接入其他设备的蓝牙操作

Readme

applets-ble

npm LICENSE MIT

uniapp 和 微信小程序蓝牙连接核心操作封装模块处理,可快速接入其他设备的蓝牙操作,提高可维护性以及可移植性。

安装使用

使用npm或者yarn快速安装

npm install applets-ble -S
# or yarn
yarn add applets-ble -S

根据模块使用工具库,下面简单举例: ES Module

import { createBle } from 'applets-ble';
const options = {
  // 适配的蓝牙名称集合
  bleName: [
    "XXX" // 要搜索的蓝牙名称
  ],
  // 查找serviceId的条件值
  serviceIdCondition: "", 
  clientType: 0, // 使用端的类型,0为微信小程序,1为uni APP
}
const ble = createBle(options);

// 监听事件处理
ble.listen(res => {
  if (res.type == 'connect') {
    switch(res.data){
      case "未打开适配器":
        break
      case "蓝牙已连接":
        break
      case ""
        break
    }
  }else if (res.type == "response") {
     console.log('收到设备消息响应:', res)
    // TODO 处理设备返回的数据
  }
});

// 移除监听事件处理
ble.removeListen();

// 蓝牙初始化
ble.init(); 

// 关闭蓝牙
ble.close();

// 发送指令
ble.send();

CommonJS

const { createBle } = require('applets-ble');
const options = {
  // 适配的蓝牙名称集合
  bleName: [
    "XXX" // 要搜索的蓝牙名称
  ],
  // 查找serviceId的条件值
  serviceIdCondition: "", 
  clientType: 0, // 使用端的类型,0为微信小程序,1为uni APP
}
const ble = createBle(options);

// 监听事件处理
ble.listen(res => {
  if (res.type == 'connect') {
    switch(res.data){
      case "未打开适配器":
        break
      case "蓝牙已连接":
        break
      case ""
        break
    }
  }else if (res.type == "response") {
     console.log('收到设备消息响应:', res)
    // TODO 处理设备返回的数据
  }
});

// 移除监听事件处理
ble.removeListen();

// 蓝牙初始化
ble.init(); 

// 关闭蓝牙
ble.close();

// 发送指令
ble.send();

微信小程序使用npm包

1、 安装 npm 包

# 前提已经npm init或存在package.json文件
npm install applets-ble -S

2、构建npm

点击开发者工具IDE中的菜单栏:工具 --> 构建 npm

3、构建完成后即可使用 npm 包。

import { BLE } from 'applets-ble';
// 调用模块方法

API文档

详细API文档内容,后续补充