Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
async-stream-emitter
Advanced tools
EventEmitter using AsyncIterableStream.
let emitter = new AsyncStreamEmitter();
(async () => {
await wait(10);
emitter.emit('foo', 'hello');
// This will cause all for-await-of loops for that event to exit.
// Note that you can also use the 'break' statement inside
// individual for-await-of loops.
emitter.closeListener('foo');
})();
(async () => {
for await (let data of emitter.listener('foo')) {
// data is 'hello'
}
console.log('The listener was closed.');
})();
// Utility function.
function wait(duration) {
return new Promise((resolve) => {
setTimeout(() => {
resolve();
}, duration);
});
}
Note that unlike with EventEmitter
, you cannot get the count for the number of active listeners at any given time.
This is intentional as it encourages code to be written in a more declarative style and lowers the risk of memory leaks.
If you want to track listeners, you should do it yourself.
The new ECMAScript Symbol
type should make tracking object references easier: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol
FAQs
An alternantive to EventEmitter using consumable streams.
The npm package async-stream-emitter receives a total of 27,918 weekly downloads. As such, async-stream-emitter popularity was classified as popular.
We found that async-stream-emitter 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.