3.2.0 • Published 5 years ago
@style/http-queue v3.2.0
@style/http-queue
A fire-and-forget HTTP request queue implementation for browsers.
Installation
npm i --save @style/http-queue
Usage example
import queue from '@style/http-queue';
async () => {
const { schedule, drain } = queue();
// Schedule some HTTP requests
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Almec'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Amee'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Darth Bane'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Beed'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Sio Bibble'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Dengar'}});
schedule({verb: 'POST', url: 'http://analytics.stylelounge.de', data: {character: 'Feral'}});
// Let's drain the queue ("waits" until all requests has been sent OR terminates after configurable
// timeout; default = 3000 ms)
await drain();
};
Debugging
The library uses the debug library internally. You can activate the debug messages by executing the following in your console:
localStorage.debug = '@stylelounge/http-queue:*';
Development
Available npm scripts
name | description |
---|---|
npm run build | Creates a clean build of this library (installs all npm packages , the TS typings and compiles everything). |
npm run lint | Lints the TS code via tslint . |
npm run test (a.k.a. npm test ) | Performs all the tests within the project. |
Semantic commit messages
This project follows a pattern, called semantic commit messages. By using this convention it is possible to infer the next version number based on the last commit messages when creating a new release.
3.3.0-beta.4
5 years ago
3.2.0
5 years ago
3.3.0-beta.3
5 years ago
3.3.0-beta.2
5 years ago
3.3.0-beta.1
5 years ago
3.2.0-beta.0
5 years ago
3.1.4
6 years ago
3.1.4-beta.2
6 years ago
3.1.4-beta.1
6 years ago
3.1.4-beta.0
6 years ago
3.1.3
6 years ago
3.1.2
6 years ago
3.1.1
6 years ago
3.0.0
7 years ago
2.0.2
7 years ago
1.3.1
7 years ago
1.3.0
8 years ago
1.2.0
8 years ago
1.1.1
8 years ago
1.0.1
8 years ago
0.0.1
8 years ago
2.0.0
8 years ago
1.0.0
8 years ago
1.1.0
8 years ago