Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@utsubo/events

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@utsubo/events

react library for custom events. Based on eventemitter3

  • 0.1.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
15K
increased by14.6%
Maintainers
2
Weekly downloads
 
Created
Source

@utsubo/events

Minimalist library to emit and receive custom events.

yarn add @utsubo/events

Example

import { onEvent, offEvent, emitEvent, useEvent } from '@utsubo/events'

// Create an event listener
const handler = (e) => console.log('event', e)
onEvent('event', handler, { once: false })

// Dispatch a payload to event listeners
emitEvent('event', 'event data')

// Remove the event listener
offEvent('event', handler, { once: false })

// React hook bindings to create reactive handlers.
function Component() {
  useEvent('event', (e) => console.log('event', e), [key], { once: false })
}

Keywords

FAQs

Package last updated on 15 Nov 2022

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