-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e139a85
commit fa21571
Showing
3 changed files
with
2 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,7 @@ | ||
// File Dependencies | ||
// import { WS_EVENT_NAMES } from "./constants"; | ||
|
||
// Interfaces | ||
// Question - can interfaces be embedded as types within other interfaces? | ||
export interface EventListenersInterface { | ||
open: Array<Function>; | ||
message: Array<Function>; | ||
error: Array<Function>; | ||
close: Array<Function>; | ||
[key: string]: Array<Function>; | ||
} | ||
|
||
// /** | ||
// * Validates that the event passed in is a valid eventListener event | ||
// * @param {string} event - the event name | ||
// */ | ||
// export const validateEvent = (event: string) => { | ||
// if (WS_EVENT_NAMES.indexOf(event) === -1) { | ||
// throw new Error(`${event} is not a valid eventListener event`); | ||
// } | ||
// }; | ||
|
||
// /** | ||
// * Loops through a list of events in the eventListeners object to validate them | ||
// * @param {object} eventListeners | ||
// */ | ||
// export const validateEvents = (eventListeners: object) => { | ||
// const eventList = Object.keys(eventListeners); | ||
// eventList.forEach(validateEvent); | ||
// }; | ||
|
||
// /** | ||
// * Makes sure that any eventListeners object which might miss an event will have them prefilled in | ||
// * @param {object} eventListeners - The eventListeners object parameter | ||
// * @returns {object} The eventListeners object parameter, with any missing events prefilled in | ||
// */ | ||
// export const prefillMissingEvents = ( | ||
// eventListeners: EventListenersInterface = { | ||
// open: [], | ||
// close: [], | ||
// error: [], | ||
// message: [] | ||
// } | ||
// ) => { | ||
// WS_EVENT_NAMES.forEach((eventName: string) => { | ||
// if (!eventListeners[eventName]) eventListeners[eventName] = []; | ||
// }); | ||
// return eventListeners; | ||
// }; |