From e954f30e954b58340058438aae4309b7b503485f Mon Sep 17 00:00:00 2001 From: Marcin Dryka Date: Sun, 10 Jun 2018 12:06:16 +0200 Subject: [PATCH] Empty event callback --- .rebuild.ts | 0 packages/hadron-events/src/eventManagerProvider.ts | 8 ++++---- 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 .rebuild.ts diff --git a/.rebuild.ts b/.rebuild.ts new file mode 100644 index 0000000..e69de29 diff --git a/packages/hadron-events/src/eventManagerProvider.ts b/packages/hadron-events/src/eventManagerProvider.ts index f3ded0d..c00bcaf 100644 --- a/packages/hadron-events/src/eventManagerProvider.ts +++ b/packages/hadron-events/src/eventManagerProvider.ts @@ -24,12 +24,12 @@ const eventManagerProvider = ( }); }, emitEvent: (eventName: string, callback: CallbackEvent) => { - if (eventName === '' || eventName === null) { - throw new Error('eventName can not be empty'); + if (typeof eventName !== 'string' || eventName.trim() === '') { + throw new Error('Event name can not be empty'); } - if (callback === undefined || callback === null) { - callback = () => null; + if (typeof callback !== 'function') { + throw new Error('Event callback can not be empty'); } return emitter