mirror of
https://github.com/mempool/mempool.git
synced 2025-01-10 07:26:46 +01:00
4dacf292c2
Log backend messages to syslog. fixes #135
25 lines
565 B
TypeScript
25 lines
565 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class AudioService {
|
|
audio = new Audio();
|
|
isPlaying = false;
|
|
|
|
constructor() { }
|
|
|
|
public playSound(name: 'magic' | 'chime' | 'cha-ching' | 'bright-harmony') {
|
|
if (this.isPlaying) {
|
|
return;
|
|
}
|
|
this.isPlaying = true;
|
|
this.audio.src = '../../../resources/sounds/' + name + '.mp3';
|
|
this.audio.load();
|
|
this.audio.play().catch((e) => {
|
|
console.log('Play sound failed' + e);
|
|
});
|
|
setTimeout(() => this.isPlaying = false, 100);
|
|
}
|
|
}
|