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

@emoji-gen/ptero

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emoji-gen/ptero

Simple CustomEvent listener and emitter

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ptero

npm build License

:deciduous_tree: Simple CustomEvent listener and emitter

Getting started

$ npm install @emoji-gen/ptero --save # for npm users
$ yarn add @emoji-gen/ptero           # for yarn users
import { Ptero } from '@emoji-gen/ptero'

const ptero = new Ptero()

ptero.on('eventname', e => {
    console.log(e.detail) // => { foo: 1 }
})

ptero.emit('eventname', { foo: 1 })

References

new Ptero(target)

Create new Ptero instance.

// Default target is `window`
const ptero = new Ptero()
// Set `document.body` for an event target
const ptero = new Ptero(document.body)

ptero.addListener(event, listener)

Listen a single custom event.

ptero.addListener('eventname', e => {
    console.log(e.detail)
})

ptero.on(event, listener)

Listen a single custom event or multi custom events.

ptero.on('eventname', e => {
    console.log(e.detail)
})

ptero.on(['eventname1', 'eventname2'], e => {
    console.log(e.detail)
})

ptero.removeListener(event, listener)

Stop listening a single custom event.

const listener = e => {
    console.log(e.detail)
}

ptero.addListener('eventname', listener)
ptero.removeListener('eventname', listener)

ptero.off(event, listener)

Stop listening a single custom event or multi custom events.

const listener = e => {
    console.log(e.detail)
}

ptero.on('eventname1', listener)
ptero.on(['eventname2', 'eventname3'], listener)

ptero.off('eventname1', listener)
ptero.off(['eventname2', 'eventname3'], listener)

ptero.emit(event, detail)

Dispatch a single custom event.

ptero.emit('eventname', { foo: 1 })

Development

$ yarn start     # for development
$ yarn run build # for production
$ yarn test      # run tests

License

MIT © Emoji Generator

FAQs

Package last updated on 22 Jul 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