Shortcut for window.dispatchEvent.
yarn add @jswork/next-root-dispatch
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' });
Code released under the MIT license.