webmidi icon indicating copy to clipboard operation
webmidi copied to clipboard

fix: Input/Output Polymorphism

Open dopry opened this issue 7 months ago • 6 comments

This is a pseudo code to illustrate the concept. I'm not very good with JSDoc these days. I personally find it easier just to work with typescript so TSC and VS code do all the heavy lifting to generate my types.

This implementation refactors Input and Output with a base class of Port.

applies to #229

dopry avatar May 31 '25 00:05 dopry

Thanks a lot for your work on this. However, before I can merge it, the documentation needs to be carefully reviewed. The auto-generated documentation on the website relies on jsdoc being correct. From casual perusal, I can see that the Port object's documentation has probably been copied over from the Input object and carries over several references that are no longer valid.

Unfortunately, I do not have time right now to do this myself.

djipco avatar Jun 01 '25 12:06 djipco

Thanks so much for your work on this. However, a quick search still reveals many references to Input in the documentation for Port.

djipco avatar Jun 02 '25 13:06 djipco

done

dopry avatar Jun 03 '25 12:06 dopry

Again, thanks for your work on this. However, there is still a part that is missing: the unit tests. As far as I know, this library has been pretty stable and I do not want to introduce any forms of regression.

So, we would need a new test file in /test for the Port object and the Input and Output tests may need to be adjusted.

djipco avatar Jun 04 '25 19:06 djipco

Cool. Probably beyond my availability for additional work on this issue. We're actually moving away from WebMidi.js to just use the Wed MIDI API directly in our use cases. Thanks for entertaining it. Feel free to wrap it up if you're interested or close it if you're not.

dopry avatar Jun 05 '25 18:06 dopry

I dont' really have time to work on this currently. I'll leave it open and, hopefully, I can fin some time. If someone else wants to take a stab at updating the tests, that would be awesome.

djipco avatar Jul 05 '25 16:07 djipco