
Product
Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.
miniprogram-queue
Advanced tools
Queue Package for MiniProgram API
小程序操作队列化(
wx.request,wx.downloadFile,wx.uploadFile)
Features:
abort)npm i miniprogram-queue -S
/// app.js (entry of your app), call apply();
/// 在小程序入口(通常是app.js) 调用 apply() 函数, 实现自动注入
import {apply} from 'miniprogram-queue';
apply();
// 替换默认API, wx.request, wx.uploadFile,wx.downloadFile
WxQueue (手动管理队列)import {WxQueue} from 'miniprogram-queue';
//创建请求队列
const requestQueue = new WxQueue(wx.request,10);
// const uploadQueue = new WxQueue(wx.uploadFile,10);
// const downloadQueue = new WxQueue(wx.downloadFile,10);
// 发送请求
let task = requestQueue.push({
url:'https://github.com/NewFuture/miniprogram-network/'
});
// task.abort() 可取消操作
与官网API参数兼容 支持 扩展参数:
onProgressUpdate 进度回调函数onHeadersReceived 响应头回调函数jump (默认false)是否插队timestamp (默认false) 是否记录时间戳,是则complete回调中会包含 一个time字段{
send: number,
response: number
}
兼容API
同时 downloadFile 和 uploadFile 支持通过process 参数 之间设置进度回调
//第二个参数为true时优先级最高
requestQueue.push(param,true);
所有操作返回一个Task对象,可取消操作
注意: 和官方API一致 取消时依然会执行complete(如果配置了)。
var task = wx.request(obj);
task.abort();
var task = queue.push(obj);
task.abort();
DownloadTask.onProgressUpdate(function callback)UploadTask.onProgressUpdate(function callback)小程序
onProgressUpdateAPI的接口,设计上不太合理, 这个接口放在请求发生时更合适,而非在Task创建后。
此处保留了对onProgressUpdate的兼容适配,同时提供了可通过参数(progress)传入的方法
const task =uploadQueue.push({
// 其他参数
onProgressUpdate:processCallback// callback function
onHeadersReceived:console.log
});
// function processCallback(progress,currentBytes,totalBytes){}
// obj update object
const task = wx.uploadFile(obj);
// 保留原生调用方式支持
task.onProgressUpdate(processCallback); // callback function
// function processCallback(progress,currentBytes,totalBytes){}
FAQs
Queue Management for Wechat MiniProgram
The npm package miniprogram-queue receives a total of 23 weekly downloads. As such, miniprogram-queue popularity was classified as not popular.
We found that miniprogram-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.

Research
More than 140 Mastra npm packages were compromised in a supply chain attack that used a typosquatted dependency to deliver a cross-platform infostealer during installation.