Skip to content

Option to swap out requestMIDIAccess function when enabling WebMIDI#224

Merged
djipco merged 1 commit into
djipco:masterfrom
jjeff:feat/requestMIDIAccessFunction
Mar 26, 2022
Merged

Option to swap out requestMIDIAccess function when enabling WebMIDI#224
djipco merged 1 commit into
djipco:masterfrom
jjeff:feat/requestMIDIAccessFunction

Conversation

@jjeff

@jjeff jjeff commented Jan 21, 2022

Copy link
Copy Markdown
Contributor

Adds a requestMIDIAccessFunction property to the options object argument of WebMIDI.enable(). If this property exists (and is a function), it will be called instead of navigator.requestMIDIAccess. This seems to work in my tests, however I can’t get WebMIDI to build because there seems to be a missing typescript-declarations/generate.js file… so I’m not sure if the unit tests are working correctly for me.

@djipco

djipco commented Jan 23, 2022

Copy link
Copy Markdown
Owner

Awesome! Thanks for the PR.

Before I can merge it, there are a few things that need to be adjusted though...

because there seems to be a missing typescript-declarations/generate.js file…

My bad. I renamed the file when I moved from automatic generation to manual. I just committed it back. Are you able to run the tests now?

Speaking of tests, we will need a unit test for that new option. It should go in the enable() section of
/test/WebMidi.test.js.

Also, can you copy the modified jsdoc comments to the /typescript/webmidi.d.ts file?

@djipco
djipco self-requested a review January 23, 2022 14:50
@jjeff
jjeff force-pushed the feat/requestMIDIAccessFunction branch 2 times, most recently from a05002f to 48102e3 Compare January 27, 2022 18:39
@djipco

djipco commented Mar 24, 2022

Copy link
Copy Markdown
Owner

I just saw your updated PR moments ago. So sorry. I'm looking at it now.

@djipco

djipco commented Mar 24, 2022

Copy link
Copy Markdown
Owner

Wow! This is a mammoth PR. I will need more time to go through it. I'll get back to you.

@jjeff

jjeff commented Mar 24, 2022

Copy link
Copy Markdown
Contributor Author

I probably should have commented after I submitted the changes. I actually thought I did... but it looks like I didn't. Sorry about that.

Yeah. This changes all/most of the tests to use the new mock MIDI device. They're not all passing yet... and I'm not sure if it's the tests or the WebMidi library itself. But you would be better than me at determining that.

Let me know if you have any questions.

@djipco

djipco commented Mar 24, 2022

Copy link
Copy Markdown
Owner

I don't know if I was supposed to receive a notification from GitHub in this scenario but I'm pretty sure I didn't. Anyway, I am SO sorry I missed your updates. The problem is that, meanwhile, I updated the library. So your PR rolls back some things I changed.

Would it be at all possible for you to submit a new PR plotted against the latest version? Also, would it be possible to separate the changes to the tests from the changes to the library? I am a bit nervous to change the testing model, especially if some tests do not yes pass. Perhaps we could just mark the new requestMIDIAccessFuntion feature as experimental in the documentation until the tests are sorted out?

Again, so sorry about the misunderstanding. I really wish to work with you on this as your PR will be very valuable to the community.

@jjeff

jjeff commented Mar 24, 2022

Copy link
Copy Markdown
Contributor Author

Yeah. I'll take a look over the weekend and see if I can rebase on the current main and split the tests out into a separate PR.

All good. 👍

adds a requestMIDIAccessFunction property to the options object argument of `WebMIDI.enable()`. If this property exists (and is a function), it will be called instead of `navigator.requestMIDIAccess`
@jjeff
jjeff force-pushed the feat/requestMIDIAccessFunction branch from 48102e3 to 4462471 Compare March 26, 2022 14:39
@jjeff

jjeff commented Mar 26, 2022

Copy link
Copy Markdown
Contributor Author

Okay. This PR has been rebased against main. Not a mammoth PR anymore...

However, the Testing PR #232 is pretty mammoth and requires/includes this PR. That's where I could use some of your expertise in solving the testing problems.

@djipco
djipco merged commit e39f977 into djipco:master Mar 26, 2022
@djipco

djipco commented Mar 26, 2022

Copy link
Copy Markdown
Owner

Awesome! Thank you so much @jjeff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants