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

y-event

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

y-event

Event system

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Intro

A event system could emit first, register later.
Or works as normal

Installation

npm i -D y-event
# or
yarn add --dev y-event

Usage

import event from 'y-event'

// emit first, register later
event.$always('event1')
event.$on('event1', () => {
  console.log('event1 works') // event1 works
})

// normal use
event.$on('event2', (...args) => {
  console.log('event2', ...args) // event2, 1, 2, 3
})
event.$emit('event2', 1, 2, 3)

// off
event.$off('event2')
event.$emit('event2') // nothing happens

License

MIT

Copyright (c) 2017-present, Yuchen Liu

FAQs

Package last updated on 08 Nov 2017

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