-
Notifications
You must be signed in to change notification settings - Fork 0
Added connection-specific interfaces and factory functions for exporting instead #50
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
Conversation
For mocking connections.
Deploying microbit-connection with
|
Latest commit: |
65e8de4
|
Status: | ✅ Deploy successful! |
Preview URL: | https://0f4c4aa4.microbit-connection.pages.dev |
Branch Preview URL: | https://mock-connections.microbit-connection.pages.dev |
Let's:
Then client code will need to be updated to call the function instead of the constructor but otherwise stay the same in terms of type names. Please can we also look at whether there's a better approach to typing the events? Ideally we'd be able to add common events only via DeviceConnection and events that only applied e.g. USB would only be available via that interface. |
src/demo.ts
Outdated
@@ -194,7 +195,7 @@ const createConnectSection = (type: ConnectionType): Section => { | |||
}; | |||
|
|||
const createFlashSection = (): Section => { | |||
if (!connection.flash) { | |||
if (typeof connection["flash"] !== "function") { |
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.
Let's use ConnectionType to determine this.
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.
Have addressed this here: 29257d6
…t-connection into mock-connections
See below for commits addressing the comments:
Maybe like this e5929d2? Have also updated the documentation here: 65e8de4 |
Code changes look good. I'd like to spend a bit of time playing around with how it feels to use before we go ahead. |
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.
I think this approach makes sense. Looks good.
Uh oh!
There was an error while loading. Please reload this page.