@stacksjs/events
TypeScript icon, indicating that this package has built-in type declarations

0.68.1 • Public • Published

Stacks Events

Functional event emitting.

☘️ Features

  • Functional event emitting

🤖 Usage

bun install -d @stacksjs/events

Now, you can use it in your project:

import { all, dispatch, listen, off } from '@stacksjs/events'

// listen to an event
listen('foo', e => console.log('foo', e))

// listen to all events
listen('*', (type, e) => console.log(type, e))

// fire an event
dispatch('foo', { a: 'b' })

// clearing all events
all.clear()

// working with handler references:
function onFoo() {}
listen('foo', onFoo) // listen
off('foo', onFoo) // unlisten

To view the full documentation, please visit https://stacksjs.org/events.

🧪 Testing

bun test

📈 Changelog

Please see our releases page for more information on what has changed recently.

🚜 Contributing

Please review the Contributing Guide for details.

🏝 Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discussions on GitHub

For casual chit-chat with others using this package:

Join the Stacks Discord Server

🙏🏼 Credits

Many thanks to the following core technologies & people who have contributed to this package:

📄 License

The MIT License (MIT). Please see LICENSE for more information.

Made with 💙

Package Sidebar

Install

npm i @stacksjs/events

Weekly Downloads

34

Version

0.68.1

License

MIT

Unpacked Size

3.4 kB

Total Files

3

Last publish

Collaborators

  • chrisbreuer