mirror of
https://github.com/chuot/rdio-scanner.git
synced 2026-08-13 16:33:01 -06:00
Better handling of promise return in beep()
This commit is contained in:
parent
870109e93a
commit
fff40747d2
|
|
@ -29,6 +29,7 @@ import {
|
|||
RdioScannerEvent,
|
||||
RdioScannerGroup,
|
||||
RdioScannerGroupStatus,
|
||||
RdioScannerKeypadBeeps,
|
||||
RdioScannerLiveFeedMap,
|
||||
RdioScannerSearchOptions,
|
||||
} from './rdio-scanner';
|
||||
|
|
@ -169,24 +170,18 @@ export class AppRdioScannerService implements OnDestroy {
|
|||
|
||||
beep(style = RdioScannerBeepStyle.Activate): Promise<void> {
|
||||
return new Promise((resolve) => {
|
||||
if (!this.beepContext || !this.config.keypadBeeps) {
|
||||
resolve();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const context = this.beepContext;
|
||||
|
||||
const gn = context.createGain();
|
||||
const seq = this.config.keypadBeeps && this.config.keypadBeeps[style];
|
||||
|
||||
const seq = this.config?.keypadBeeps[style];
|
||||
|
||||
if (!Array.isArray(seq) || !seq.length) {
|
||||
if (!context || !seq) {
|
||||
resolve();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const gn = context.createGain();
|
||||
|
||||
gn.gain.value = .1;
|
||||
|
||||
gn.connect(context.destination);
|
||||
|
|
|
|||
Loading…
Reference in a new issue