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

pixiu

v0.7.0

Published

A dom number-values collector

Downloads

6

Readme

pixiu

A dom number-values collector

NPM version Build Status Dependency Status

INSTALL

npm install pixiu

REQUIRE / IMPORT

const pixiu = require('pixiu'); // 全部引用

const auto = require('pixiu/auto'); // 只引用自动的收集部分
const manual = require('pixiu/manual'); // 只引用手动的收集部分

全部引用和单独分开引用自动/手动有些许不同。 分开引用时API直接挂在相应的对象上; 全部引用自动的API挂在auto属性下,而手动的API挂在manual属性下。

API

auto

collect(): Array<Object>

收集所有仅包含唯一数字文本节点的dom节点,返回一个数组,每项是个键值对,键为编码后的selector,值为数字。

observe(time: int = 500, callback: Function): void

侦听dom变更,time为回调的延迟,低于time的会被忽略,防止连续变更引发的频繁回调。 即便是设置为0,也不是同步触发的,因为MutationObserver本身异步的缘故。 callback的参数有2个:和上述一样的数组;以及JSON.stringify后的数组字符串。

collectAndObserve(time: int, callback: Function): Array<Object>

收集并且侦听,相当于上述2个API的合集。

disconnect(): void

暂停侦听。

manual

collect(key: String = 'pixiu'): Array<Object>

收集所有属性包含key且仅包含唯一文本节点的dom节点,返回一个数组,每项是个键值对,键为属性key的值,值为dom的文本内容。 注意它不强制要求是数字。

observe(key: String = 'pixiu', time: int = 500, callback: Function): void

侦听dom变更,key同上,time为回调的延迟,低于time的会被忽略,防止连续变更引发的频繁回调。 即便是设置为0,也不是同步触发的,因为MutationObserver本身异步的缘故。 callback的参数有2个:和上述一样的数组;以及JSON.stringify后的数组字符串。

collectAndObserve(key: String = 'pixiu', time: int = 0, callback: Function): Array<Object>

收集并且侦听,相当于上述2个API的合集。

disconnect(): void

暂停侦听。

tag

encode(s: String): String

编码dom的nodeName为简写字符,未知则原样返回。

decode(s: String): String

解码简写字符为dom的nodeName,未知则原样返回。

decodeAll(s: String): String

解码整个selector并返回。