I am discovering right now the web midi API with a connected USB piano.
Following [this guide](https://www.smashingmagazine.com/2018/03/web-midi-api/) (and reading [the documentation](https://www.w3.org/TR/webmidi/)) I understand that you can assign a function to the event "onmidimessage".

My problem is that this function is called for every pressed/released single note, so how should I deal with multiple notes pressed at the same time, with the purpose of playing a chord?