use-app-events
Version:
Event system for global communication in vanilla JavaScript and React.
71 lines (48 loc) ⢠1.96 kB
Markdown
# use-app-events
   
Event system for global communication in vanilla JavaScript and React.
šØ Send events and data from one part of the app to another.
š© Listen for events to occur in the app and process their payload.
š Organize and manage your global app state via events.
<br/>
## Facts
š¦ Small package size
š Tree-shakeable
š Well documented
š”ļø Strictly typed with TypeScript
ā»ļø Works between different browser <u>tabs</u>
āļø Exports a convenient hook for <u>React</u> developers
<br/>
## Install
**npm**
```bash
npm install use-app-events
```
**pnpm**
```bash
pnpm add use-app-events
```
<br/>
## Exports
- **notifyEventListeners**
- Function to notify all listeners of the specified event type(s) subscribed via `listenForEvents`.
- **listenForEvents**
- Function to subscribe and listen for the specified event type(s) to occur in the app.
- **listenForEvents.once**
- Function to subscribe and listen for the specified event type(s) to occur in the app **once**.
- **useAppEvents**
- Hook for managing application events in React.
- **heap**
- _(readonly)_ Collection of resources operated by the package.
- **options**
- Collection of options used to adjust the behavior of the package.
<br/>
<br/>
> _This is a truncated version of README to reduce the package size._
>
> ##### [[_See full docs on GitHub_]](https://github.com/aimtbr/use-app-events?tab=readme-ov-file#use-app-events)
<br/>
## License
MIT
## Author
Maksym Marchuk