13 lines
386 B
TypeScript
Raw Normal View History

2018-03-11 02:00:06 +00:00
import { AnimeNotifier } from "../AnimeNotifier"
// Play audio file
export function playAudio(arn: AnimeNotifier, button: HTMLButtonElement) {
if(!arn.audio) {
arn.audio = document.createElement("audio") as HTMLAudioElement
let source = document.createElement("source") as HTMLSourceElement
source.src = button.dataset.src
arn.audio.appendChild(source)
}
arn.audio.play()
}