zhengjunxin / Wx Queue Request
Licence: mit
控制微信小程序 wx.request 并发请求数量
Stars: ✭ 65
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Wx Queue Request
Wx Promise Request
解决微信小程序 wx.request 请求的并发数限制、不支持异步问题
Stars: ✭ 226 (+247.69%)
Mutual labels: queue, request
Cdcontainers
Library of data containers and data structures for C programming language.
Stars: ✭ 57 (-12.31%)
Mutual labels: queue
Buckets Js
A complete, fully tested and documented data structure library written in pure JavaScript.
Stars: ✭ 1,128 (+1635.38%)
Mutual labels: queue
Social Media Profile Scrapers
Fetch user's data across social media
Stars: ✭ 60 (-7.69%)
Mutual labels: request
Geeksforgeeks Dsa 2
This repository contains all the assignments and practice questions solved during the Data Structures and Algorithms course in C++ taught by the Geeks For Geeks team.
Stars: ✭ 53 (-18.46%)
Mutual labels: queue
Alagarr
🦍 Alagarr is a request-response helper library that removes the boilerplate from your Node.js (AWS Lambda) serverless functions and helps make your code portable.
Stars: ✭ 58 (-10.77%)
Mutual labels: request
Redux Query
A library for managing network state in Redux
Stars: ✭ 1,055 (+1523.08%)
Mutual labels: request
Docker Laravel Queue Worker
A docker image for working with queues being monitored by supervisor as recommended by laravel.
Stars: ✭ 60 (-7.69%)
Mutual labels: queue
Yii2 Async
Provides translucent api & queues for moving large tasks out of request context with SQL, Redis or AMQP.
Stars: ✭ 64 (-1.54%)
Mutual labels: queue
wx-queue-request
管理微信小程序 wx.request
方法的并发数,解决请求数大于 10 时,直接不请求的问题。如果需要 wx.request
方法支持 Promise,可以使用 wx-promise-request 库哦。
下载
由于小程序不支持 npm,所以直接右键保存 index.js 文件即可。
使用
在 app.js 引入并执行即可
import { queue } from './wx-queue-request'
queue()
// 因为请求队列被管理
// 即使并发请求数超过 10 也不会报错了
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
wx.request({url: 'test.php'})
API
queue([concurrency])
直接对全局的 wx.request
进行封装,调用后 wx.request
即会管理队列。并发数默认为 10。
import { queue } from './wx-queue-request'
queue(5) // 指定并发数为 5
wx.request({url: 'test.php'})
queueRequest(request, [concurrency])
对指定请求函数进行封装,返回被管理队列的函数,并发数 concurrency 默认为 10。
import { queueRequest } from './wx-queue-request'
export default queueRequest(wx.request, 10)
License
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].