Right now only setting the onstatechange property is supported
const access = await navigator.requestMIDIAccess()
access.onstatechange = () => {}
But the Web Midi API also allows using an event listener:
const access = await navigator.requestMIDIAccess()
access.addEventListener('statechange', () => {})
This can be useful if you want to have multiple listeners for the statechange event.