New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

race-event

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

race-event

Race an event against an AbortSignal

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
decreased by-30.66%
Maintainers
1
Weekly downloads
 
Created
Source

race-event

codecov CI

Race an event against an AbortSignal

About

Race an event against an AbortSignal, taking care to remove any event listeners that were added.

Example

const { raceEvent } = require('race-event')

const controller = new AbortController()
const emitter = new EventTarget()

setTimeout(() => {
  controller.abort()
}, 500)

setTimeout(() => {
  // too late
  emitter.dispatchEvent(new CustomEvent('event'))
}, 1000)

// throws an AbortError
const resolve = await raceEvent(emitter, 'event', controller.signal)

Install

$ npm i race-event

Browser <script> tag

Loading this module through a script tag will make it's exports available as RaceEvent in the global namespace.

<script src="https://unpkg.com/race-event/dist/index.min.js"></script>

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

FAQs

Package last updated on 05 Jan 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc