Skip to content

Commit 0987113

Browse files
author
Ke, Mingze
committed
Stop playing before board disconnects
1 parent 9cab93a commit 0987113

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

DFPlayer.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
this._rx = RX;
2727
this._tx = TX;
2828
self = this;
29+
board.on(webduino.BoardEvent.BEFOREDISCONNECT, this.stop.bind(this));
30+
board.on(webduino.BoardEvent.ERROR, this.stop.bind(this));
2931
board.on(webduino.BoardEvent.SYSEX_MESSAGE,
3032
function (event) {
3133
var m = event.message;

0 commit comments

Comments
 (0)