Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
node-threading-event
Advanced tools
Readme
A simple and lightweight implementation of threading.Event
in Node.js
Node.js 15.0.0 or newer is required.
npm install node-threading-event
const NodeThreadingEvent = require('node-threading-event');
const event = new NodeThreadingEvent();
event.set();
if (event.isSet()) {
console.log('Event is set !');
}
event.clear();
(async function() {
setTimeout(() => {
event.set();
}, 1000);
const res = await event.wait();
console.log('Event is set after 1 second');
})()
(async function() {
setTimeout(() => {
event.set();
}, 500);
const res = await event.wait(1000);
console.log('Event is set after 1 second');
})()
Set the internal flag to true.
void
Return true if and only if the internal flag is true.
boolean
Reset the internal flag to false.
void
Block until the internal flag is true.
If the internal flag is true on entry, return immediately. Otherwise, block until another set() call to set the flag to true, or until the optional timeout occurs.
timeout
- (optional) - Specify the time to wait until the timeout occurs.Promise<boolean>
FAQs
An implementation of the threading.Event Python package
The npm package node-threading-event receives a total of 2 weekly downloads. As such, node-threading-event popularity was classified as not popular.
We found that node-threading-event demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.