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

xpromisequeue

v1.5.3

Published

这是一个Javascript Promise的执行队列模块,里面的每一个Promise都是按顺序执行的,您也可以指定一定的优先级来决定队列的执行顺序。

Readme

简介

这是一个Promise的执行队列模块,里面的每一个Promise都是按顺序执行的,您也可以指定一定的优先级来决定队列的执行顺序。

使用场景

  • 需要按顺序来运行某一组任务,比如:当A处理后才能执行B,B处理后才能执行C...
  • 示例场景:当一个页面的交互很复杂时,某些业务逻辑可能会不定时地向页面发出多个非阻塞式的弹窗消息,为避免多个弹窗同时展现在页面上,可以采用此模块来顺序执行弹窗逻辑,只有当前面的弹窗处理完毕后,才会处理后面的弹窗逻辑。

如何使用

流程

API

公开的模块内容为export default { QItem, Queue },其中QItem是队列中的执行项,Queue是队列。

QItem:

Queue:

简单使用

//先注册队列后,再统一执行
new Queue().reg(new QItem(function(){
	setTimeout(()=>{
		console.log('test 1...');
		this.resolve();
	},2000);
})).reg(new QItem(function(){
	setTimeout(()=>{
		console.log('test 2...');
		this.resolve();
	},3000);
})).run();

//test 1...
//test 2...


//先执行,再动态注册
new Queue().run().reg(new QItem(function(){
	setTimeout(()=>{
		console.log('test 1...');
		this.resolve();
	},2000);
})).reg(new QItem(function(){
	setTimeout(()=>{
		console.log('test 2...');
		this.resolve();
	},3000);
}));

//test 1...
//test 2...

Demo预览图

具体示例代码请参见:demo/index.html