Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Apr 4, 2022. It is now read-only.

Conversation

dstaley
Copy link
Member

@dstaley dstaley commented Feb 28, 2020

This PR replaces our usage of EventEmitter with an interface with the following shape:

interface Emitter {
  emit(type: string, event?: any): void;
  on(type: string, handler: (event?: any) => void): void;
  off(type: string, handler: (event?: any) => void): void;
}

This allows the consumer to provide their own emitter, or opt not to. For users who opt to use a small emitter like mitt, this should result in a decently smaller bundle size.

I also updated the HTTP tests to run the entire suite with an EventEmitter, with mitt, and without an event emitter at all.

Fixes #679

@dstaley dstaley requested a review from leplatrem February 28, 2020 19:59
Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dstaley dstaley merged commit d321ddd into master Mar 2, 2020
@dstaley dstaley deleted the ds/emitter-interface branch August 14, 2021 21:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace EventEmitter with minimal interface and make it optional
2 participants