Stop sound on click

This commit is contained in:
Chen Asraf
2016-03-30 11:30:03 +03:00
parent 746fae91a6
commit a01f1bc4bd

View File

@@ -17,11 +17,13 @@ class StateDefinition
constructor: ({@handler = window.stateHandler, @audio} = {}) ->
console.debug 'statedef', arguments...
if @audio?
audio = new Audio("/static/sounds/#{@audio}")
audio.play()
@soundFile = new Audio("/static/sounds/#{@audio}")
@soundFile.play()
onMessage: (message) ->
@handler.resetState()
@soundFile.pause()
@soundFile.currentTime = 0
class SplashState extends StateDefinition
constructor: ->