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

camera-capture-mp

v1.0.0

Published

use camera to generate screenshot,and return file path.

Readme

功能介绍

  • 使用组件的形式来持续获取相机画面;
  • 提供多种控制方式来控制获取相机画面截图时机:1.时间间隔;2.用户移动;3.手机俯仰角。
  • 提供 capture 方法获取 filePath 临时文件地址;

外部使用

安装依赖

npm i camera-capture-mp --save

微信小程序中引入组件

{
  "usingComponents": {
    "camera-capture-mp": "camera-capture-mp"
  }
}
<camera-capture-mp
  isPause="{{isPause}}"
  bind:capture="capture"
  bind:cameraInitDone="cameraInitDone"
/>
Page({
  data: {
    isPause: true,
  },

  cameraInitDone() {
    this.setData({
      isPause: false,
    });
  },

  capture(filePath) {
    console.log("filePath: ", filePath);
  },
});

capture 事件是如何被触发的?

当 isPause 为 true 时,capture 事件会持续触发,触发周期根据多个参数来共同决定,如:时间间隔;用户移动等

配置项

组件属性

isPause: {
      // 控制是否开启相机截图
      type: Boolean,
      value: true,
    },
    interval: {
      // 相机截图时间间隔
      type: Number,
      value: 2000,
    },
    fileQuality: {
      // 截图的照片质量
      type: Number,
      value: 0.5,
    },
    moveThreshold: {
      // 移动的阈值,可根据实际需求调整
      type: Number,
      value: 0.3, // 可选值:1.-1;2.正数;当值为-1时,表示不判断用户是否正在移动
    },
    rollThreshold: {
      // 横滚角阈值(单位:度)
      type: Number,
      value: 40, // 可选值:1.-1;2.正数;当值为-1时,表示不判断用户设备的朝向和翻滚
    },
    // 相机配置
    frameSize: {
      type: String,
      value: "medium",
    },
    devicePosition: {
      type: String,
      value: "back",
    },
    resolution: {
      type: String,
      value: "medium",
    },
    flash: {
      type: String,
      value: "off",
    },

组件事件

| 名称 | 触发时机 | 返回值 | 说明 | | :------------: | :------------: | :--------------: | ---- | | cameraInitDone | 相机初始化完成 | - | - | | capture | 相机画面截图 | 相机截图临时路径 | - |

本地测试

略~

更新发包

  1. 打包
npm run build

2.修改 package.json 中的 version 版本号

3.发布到 npm

npm publish

更新日志

略~