Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
jseventqueue
Advanced tools
[![Travis build status badge](https://api.travis-ci.org/Kirusi/jseventqueue.svg?branch=master)](https://travis-ci.org/Kirusi/jseventqueue) [![Code coverage status badge](https://coveralls.io/repos/github/Kirusi/jseventqueue/badge.svg)](https://coveralls.
A JavaScript (ES6) library for serializing event processing. It is intended to be used by multiple producers and a single consumer. Event processing is using ayns/await mechanism, which helps to process events one-at-a-time.
Reading from queue using for await
loop:
let queue = new EventQueue();
setTimeout(() => {
queue.send(0);
queue.send(1);
queue.send(2);
queue.send(3);
queue.shutdown();
}, 15);
let results = [];
for await (let data of queue) {
results.push(data);
}
// results contain [0, 1, 2, 3]
If for some reason one can't use for await
loop then a similar loop can be implemented using while
:
let queue = new EventQueue();
setTimeout(() => {
queue.send(0);
queue.send(1);
queue.send(2);
queue.send(3);
queue.shutdown();
}, 15);
let results = [];
let data;
// while loop checks whether queue was shutdown by comparing returned value
// to a special data member of the queue object
while ((data = await queue.receive()) !== queue.end) {
results.push(data);
}
// results contain [0, 1, 2, 3]
Ad-hoc reading and writing to the queue:
let queue = new EventQueue();
setTimeout(() => {
queue.send('message 1');
queue.send('message 2');
}, 15);
// receive will wait until a message is received
let msg1 = await queue.receive();
let msg2 = await queue.receive();
Using npm:
$ npm i --save jseventqueue
FAQs
[![Travis build status badge](https://api.travis-ci.org/Kirusi/jseventqueue.svg?branch=master)](https://travis-ci.org/Kirusi/jseventqueue) [![Code coverage status badge](https://coveralls.io/repos/github/Kirusi/jseventqueue/badge.svg)](https://coveralls.
The npm package jseventqueue receives a total of 1 weekly downloads. As such, jseventqueue popularity was classified as not popular.
We found that jseventqueue 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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.