diff options
Diffstat (limited to 'tape-deck.js')
-rw-r--r-- | tape-deck.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tape-deck.js b/tape-deck.js index 057c96b..8c0a2b1 100644 --- a/tape-deck.js +++ b/tape-deck.js @@ -37,6 +37,16 @@ let TapeDeck = { this.go(); Cassette.play(); }, + disableButtons: function() { + this.playButton.disable(); + this.ffButton.disable(); + this.rewindButton.disable(); + }, + enableButtons: function() { + this.playButton.enable(); + this.ffButton.enable(); + this.rewindButton.enable(); + } }; ffSound.onended = (event) => { @@ -45,8 +55,9 @@ ffSound.onended = (event) => { } else { TapeDeck.rewindButton.toggle(); } - TapeDeck.playButton.toggle({sound: false}); + TapeDeck.enableButtons(); TapeDeck.resume(); + TapeDeck.playButton.toggle({sound: false}); }; // button onclick points here @@ -59,6 +70,7 @@ window.play = function () { window.ff = function () { if (TapeDeck.isPlaying) TapeDeck.pause(); + TapeDeck.disableButtons(); TapeDeck.ffButton.toggle(); Cassette.currentTime = Cassette.currentTime + 20; ffSound.play(); @@ -66,6 +78,7 @@ window.ff = function () { window.rewind = function () { if (TapeDeck.isPlaying) TapeDeck.pause(); + TapeDeck.disableButtons(); TapeDeck.rewindButton.toggle(); Cassette.currentTime = Cassette.currentTime - 20; ffSound.play(); |