Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

[WIP] Empty event callback #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .rebuild.ts
Empty file.
8 changes: 4 additions & 4 deletions packages/hadron-events/src/eventManagerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down