-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove events/EventEmitter && move Observer to ts #2097
Conversation
This also removes annoying 'possible EventEmitter memory leak detected' warning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! 👍
Quick question:
This also removes annoying 'possible EventEmitter memory leak detected' warning.
Where were you seeing this warning?
* in every call to a handler, which is the purpose of our `trigger` method | ||
* extending the standard API. | ||
*/ | ||
trigger (event: string, ...data: Array<any>): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something to consider for the future is if we made this generic so it took T
as the data parameter so usage could look like:
trigger<T>(event: string, data: T): void { }
This could flow into emit, and then on the listen and the whole thing could have typed listeners.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
This is logged by EventEmitter if you attach more than maxListeners handlers: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a lint rule we can add to disable importing native modules?
@mad-gooze Can resolve the merge conflicts please? |
native modules can just be disabled in webpack so an error wil be thrown if you try to import then |
@mad-gooze Nice find, I like that 👍 I'm good either way when it comes to adding this webpack config tweak in this PR or in a separate PR |
@michaelcunningham19 disabled native node modules enabled by default 9fc1b75 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* origin/master: (59 commits) Change networkDetails type to "unknown". mp4-remuxer / remuxAudio() : recompute mdatSize / dont rely on audioTrack.len (video-dev#2096) Typo fix for destory -> destroy. Change responseType to string Callbacks are defined, removing TODO. video-devGH-2082: Replacing usage of Array.prototype.find/findIndex (video-dev#2117) Reduce GC pressure from ID3._utf8ArrayToStr (video-dev#2035) (misc): converting binary search to typescript (video-dev#2129) (misc) Removing IE8-specific (dead) vtt/cue code Fixed case of 'They use hls.js in production!' header and updated Viacom image link to new domain and using https (video-dev#2127) remove events/EventEmitter && move Observer to ts (video-dev#2097) Basic typescript of event handler. Update webpack to use babel loader with support for TS. (video-dev#2119) Allow console statement in test bench and saucelabs code. Lint fixes Playlist Loader conversion to TypeScript. Playlist-loader rename. Change IV handling for initSegments to just log a warning. Add handling for AES-128 encrypted initialization segments needing IV. (misc) Adding ace editor to demo to enable advanced customization (video-dev#2077) ...
This PR will...
Remove usage of EventEmitter from 'events' package in favor on EventEmitter3. It it already used in the project and claims to be a faster alternative of EventEmitter. I also moved
Observer
class to typescript.Why is this Pull Request needed?
Remove code duplication, decrease bundle size (-2.9kb).
Are there any points in the code the reviewer needs to double check?
no?
Resolves issues:
Checklist