mohayonao / web-midi-test-api

Web MIDI API for CI
8 stars 3 forks source link

Ports should emit a statechange event when they are disconnected and their connection is closed #12

Open corentingurtner opened 6 years ago

corentingurtner commented 6 years ago

Hello there, First, thanks for this mocked api which will be very useful for our tests.

I found a difference with the current Chrome implementation (I haven't found anything about such details in the specs) When a device is disconnected, each port from this device emit a statechange event, even if the "connection" property of these ports is closed. The mocked api, however, does emit an event only if the "connection" property is pending or open.

I guess the condition checking for the port connection is at https://github.com/mohayonao/web-midi-test-api/blob/master/src/MIDIPort.js#L35

I was wondering if it would be possible to follow the Chrome implementation?

Thanks, Corentin

corentingurtner commented 6 years ago

I opened a PR about this behaviour : https://github.com/mohayonao/web-midi-test-api/pull/13 Let me know what you think about it.