Adding a few files which are currently not used before a huge refactoring...

This commit is contained in:
vdv committed 2022-10-17 09:41:27 +02:00
1 parent ce074b5d22
commit ed951208e8
3 files changed
+87

No files matched your search

+25
View File
@@ -0,0 +1,25 @@
/**
*
* See https://www.pluralsight.com/guides/how-to-communicate-between-independent-components-in-reactjs (and many similar pages)
*
*
*/
const eventBus = {
on(event: string, callback: any) {
// ...
document.addEventListener(event, (e) => callback(e));
},
dispatch(event: string, data: any) {
// ...
document.dispatchEvent(new CustomEvent(event, { detail: data }));
},
remove(event: string, callback: (e: Event) => void) {
// ...
document.removeEventListener(event, callback);
},
};
export default eventBus;