![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
bluebird-events
Advanced tools
A wrapper around event emitters that returns a bluerbird promise resolved or rejected when certain events are fired.
This package wraps an event emitter object and returns a bluebird promise that is either resolved, or rejected based on what events are fired from the emitter.
Note: Bluebird-Events v2.x is NOT backwards compatible with v1.x see changelog for details
npm install bluebird-events
Optionally run tests:
npm test
import { promisify } from 'bluebird-events'
const someEmitter = new TestEmitter()
const promise = promisify(someEmitter, {
resolve: 'success-event-name',
reject: ['error-event-name', 'error-event-name-2']
})
// Will resolve the promise
someEmitter.emit('success-event-name')
// Will reject the promise with the given error
someEmitter.emit('error-event-name', new Error('Some Error Occurred!'))
emitter
[Object
] - Some object that can emit events (usually inherited from
Events.EventEmitter)
events
[Object
] - Contains a mapping of events to listen for
events.resolve
[String
, Array of Strings
, or Boolean
] - The name for the event that will
cause the promise to resolve (defaults to: 'finish'
)
events.reject
[String
, Array of Strings
, or Boolean
] - The name for the event that will
cause the promise to reject (defaults to: 'error'
)
Returns - a bluebird promise
Note: To disable listening for all resolve or reject events (including default and custom events)
just pass in false
for the resolve/reject value.
// This promise cannot be resolve successfully via an emitted event
// But it can be rejected via the default 'error' event
promisify(emitter, { resolve: false })
This library is dependent upon bluebird
, but because bluebird
is so common, there is no need to
install it multiple times so bluebird
is declared as a peerDependency
Note: bluebird
is also declared as a devDependency
for running the test suite
I welcome all pull requests. Please make sure you add appropriate test cases for any features added. Before opening a PR please make sure to run the following scripts:
npm run lint
checks for code errors and format according to ts-standardnpm test
make sure all tests passnpm run test-cover
make sure the coverage has not decreased from current master3.0.1
mocha
, husky
, ts-standard
FAQs
A wrapper around event emitters that returns a bluerbird promise resolved or rejected when certain events are fired.
The npm package bluebird-events receives a total of 44 weekly downloads. As such, bluebird-events popularity was classified as not popular.
We found that bluebird-events demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
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.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.