https://github.com/afeiship/next-root-dispatch
Shortcut for window.dispatchEvent.
https://github.com/afeiship/next-root-dispatch
custom-event dispatch emit event next window
Last synced: 4 months ago
JSON representation
Shortcut for window.dispatchEvent.
- Host: GitHub
- URL: https://github.com/afeiship/next-root-dispatch
- Owner: afeiship
- License: mit
- Created: 2020-07-07T00:28:11.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-09T16:17:50.000Z (almost 2 years ago)
- Last Synced: 2025-10-04T10:52:59.481Z (8 months ago)
- Topics: custom-event, dispatch, emit, event, next, window
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# next-root-dispatch
> Shortcut for window.dispatchEvent.
[![version][version-image]][version-url]
[![license][license-image]][license-url]
[![size][size-image]][size-url]
[![download][download-image]][download-url]
## installation
```bash
yarn add @jswork/next-root-dispatch
```
## usage
```js
import '@jswork/next-root-dispatch';
// original usage
window.dispatchEvent(new CustomEvent('resize'));
window.dispatchEvent(new CustomEvent('my-event', { detail: { foo: 'bar' } }));
// shortcut usage
nx.rootDispatch('resize');
nx.rootDispatch('my-event', { foo: 'bar' });
```
## license
Code released under [the MIT license](https://github.com/afeiship/next-root-dispatch/blob/master/LICENSE.txt).
[version-image]: https://img.shields.io/npm/v/@jswork/next-root-dispatch
[version-url]: https://npmjs.org/package/@jswork/next-root-dispatch
[license-image]: https://img.shields.io/npm/l/@jswork/next-root-dispatch
[license-url]: https://github.com/afeiship/next-root-dispatch/blob/master/LICENSE.txt
[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/next-root-dispatch
[size-url]: https://github.com/afeiship/next-root-dispatch/blob/master/dist/next-root-dispatch.min.js
[download-image]: https://img.shields.io/npm/dm/@jswork/next-root-dispatch
[download-url]: https://www.npmjs.com/package/@jswork/next-root-dispatch