feross / bitmidi.com

🎹 Listen to free MIDI songs, download the best MIDI files, and share the best MIDIs on the web
https://bitmidi.com
576 stars 53 forks source link

Update store on track end - turn stop button back to play button when player ends #30

Closed flxwu closed 6 years ago

flxwu commented 6 years ago

image

now returns back to:

image

when track has played to its end.

flxwu commented 6 years ago

Done @feross 👍

feross commented 6 years ago

Hmm, I see that you took my review literally haha. It turns out that dispatch is not actually defined in that browser/player.mjs so this doesn't work.

I'll fix it in a followup commit.

flxwu commented 6 years ago

Actually it does work, although I was wondering how it could work despite dispatch being undefined.

So I added a console output in the event case and it got called everytime dispatch got called by the player.on('end) event. IDK why, but it did the proper event dispatch call :)

feross commented 6 years ago

Oh, that's because I attached dispatch to the window for debugging purposes haha. https://github.com/feross/bitmidi.com/blob/master/src/browser/index.mjs#L13