![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
event-promisify
Advanced tools
Just run npm install event-promisify
This implementation supports basic promisification, event filtering, aggregation, custom specification of error events and is promise library agnostic (defaults to native/global Promise object).
Keep in mind that some promise implementations do not take kindly to using non-errors for rejections. Therefor when a(an) (custom) error event, the event value will be contained in an error object, but only if the event is not an error already. If the emitted object is a string however, the string will be used for the errors message, no event property will be added!
Not supported, multiple emitted values is usually a sign of bad design. If you happen to find a good reason why this should be supported, please create an issue. Meanwhile this will suffice.
function fixMultiArgEventEmitter(emitter, name, newName) {
emitter.on(name, function() { emitter.emit(newName, Array.prototype.slice.call(arguments)));
}
const promisifyEvent = require('event-promisify')(YOUR_PROMISE_CONSTRUCTOR_HERE);
promisifyEvent(someEventEmitter, 'someEvent')
.then(...)
promisifyEvent(someEventEmitter, {
name: 'someEventThatOccursmultipleTimes',
filter: event => someConditionThatReturnsABooleanWhenYouAreDone(event)
})
.then(...)
promisifyEvent(someEventEmitter, {
name: 'end',
aggregate: 'data'
})
.then(result => console.log( /* array of aggregated event data */ result.aggregated, /* final event data */ result.value))
promisifyEvent(someEventEmitter, {
name: 'end',
errorName: 'disconnect'
})
.catch(error => ...)
Custom errors will still be handled.
It usually means you did something wrong if this happens, but some libraries may emit intermediate errors when they actually should emit warnings or similar.
Be also warned that this MAY lead to promises not settling!
promisifyEvent(someEventEmitter, {
name: 'end',
ignoreErrors: true
})
.then(...)
For now more info check test.js and the index.js for further information.
FAQs
Promisification for EventEmitters.
The npm package event-promisify receives a total of 0 weekly downloads. As such, event-promisify popularity was classified as not popular.
We found that event-promisify 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.