-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fromEvent): support NodeJS Event Emitters
PR #73. * Support EventEmitters in fromEvent extra Add support for stream generation from EventEmitters. fromEvent will accept as a first argument either a DOMElement or an EventEmitter. When providing fromEvent with an EventEmitter, the third argument is always ignored. Internally, include an additional Producer type within fromEvent to support type checking. Related to #65. * Revert indent change Revert indentation change to remain consistent with project style. * Refactor guards; Conform test and source style Introduce style changes to enforce project source consistency. Adjust type checking within the fromEvent function. Specifically, duck type the first argument rather than rely on `instanceof` or `typeof` guards when deciding which producer type to instantiate. * Remove whitespace to align with project style requirements. * Remove destructuring assignment in producer class methods. * Update documentation to include both uses of the extra. * Remove whitespaces and semicolons from example markdown. * Refactor producer instantiation guards to implement duck-typing rather than `instanceof`/`typeof` checking. * Remove unused import from tests * Reorder assertion equality arguments. * Rename parameter in fromEvent documentation (`eventType`>`eventName`) * Expand emitter guard Check for both `addListener` and `emit` methods on an element supplied to fromEvent. This ensures that the function will not attempt to invoke the `addListener` method on an xstream stream instance with incorrect arguments. Instead, this scenario will throw a TypeError: 'this.node.addEventListener is not a function'
- Loading branch information
Showing
2 changed files
with
154 additions
and
23 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