Use EventTarget rather than the Node "events" module#1188
Merged
Conversation
Compiles but untried Forces us to remove the clean up in dispose so perhaps some kind of assertion should replace it.
|
Preview build will be at |
|
|
||
| const buttonTest = | ||
| "from microbit import *\nwhile True:\nif button_a.was_pressed():\ndisplay.show(Image.NO)"; | ||
| const buttonTest = `from microbit import * |
Collaborator
Author
There was a problem hiding this comment.
I've corrected the indentation in these tests which surprised me when I saw them in failure screenshots (for reasons unrelated to the indentation).
| }, | ||
| [setSelection] | ||
| ); | ||
| useEffect(() => { |
Collaborator
Author
There was a problem hiding this comment.
I think this was a listener ordering thing. I've changed it to avoid making a state update at all.
| async initialize(): Promise<void> {} | ||
|
|
||
| dispose() { | ||
| this.removeAllListeners(); |
Collaborator
Author
There was a problem hiding this comment.
We can't do this anymore as EventTarget doesn't have such API.
All listener add/removes are correctly paired except that in host.ts and a test, neither of which need to remove their listeners.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This should amount no meaningful change but is a useful preliminary to extracting the device code for reuse.
Incorporates the only meaningful file from https://github.com/DerZade/typescript-event-target/ (with licence details) to save on the dependency.