Exciting release!Introducing "safe npm". Learn more
Socket
Log inDemoInstall

y-event

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Issues
File Explorer

Advanced tools

y-event

Event system

    0.2.3latest
    GitHub

Version published
Maintainers
1
Weekly downloads
629
decreased by-36.85%

Weekly downloads

Readme

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) }) event.$emit('event2', 1, 2, 3) // event2, 1, 2, 3 // off event.$off('event2') event.$emit('event2') // nothing happens // invoke once event.$once('event3', () => { console.log('event3') }) event.$emit('event3') // 'event 3' event.$emit('event3')

License

MIT

Copyright (c) 2017-present, Yuchen Liu

FAQs

Last updated on 01 Dec 2017

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket
support@socket.devSocket SOC 2 Logo

Product

  • Package Issues
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc