From 9f4e43414027b4b2014dbdbaa8b8e8e916bc5286 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 14 Apr 2021 10:58:10 +0100 Subject: [PATCH] Wire up electron download progress to toasts --- src/hooks/useEventEmitter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useEventEmitter.ts b/src/hooks/useEventEmitter.ts index 6b5693ef95e..8f9d10bc666 100644 --- a/src/hooks/useEventEmitter.ts +++ b/src/hooks/useEventEmitter.ts @@ -15,10 +15,14 @@ limitations under the License. */ import {useRef, useEffect} from "react"; -import type {EventEmitter} from "events"; type Handler = (...args: any[]) => void; +interface EventEmitter { + on(event: string | symbol, listener: (...args: any[]) => void); + removeListener(event: string | symbol, listener: (...args: any[]) => void); +} + // Hook to wrap event emitter on and removeListener in hook lifecycle export const useEventEmitter = (emitter: EventEmitter, eventName: string | symbol, handler: Handler) => { // Create a ref that stores handler