/next-root-dispatch

Shortcut for window.dispatchEvent.

Primary LanguageJavaScriptMIT LicenseMIT

next-root-dispatch

Shortcut for window.dispatchEvent.

version license size download

installation

yarn add @jswork/next-root-dispatch

usage

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.