dispatchEvent(new CustomEvent(...)) to fireEvent(...)

This commit is contained in:
the-djmaze 2022-02-11 12:21:16 +01:00
parent 2d46eaa783
commit 44ee236709
9 changed files with 25 additions and 21 deletions

View file

@ -1,5 +1,5 @@
import * as Links from 'Common/Links';
import { doc, SettingsGet } from 'Common/Globals';
import { doc, SettingsGet, fireEvent } from 'Common/Globals';
let notificator = null,
player = null,
@ -12,7 +12,7 @@ let notificator = null,
player.src = url;
player.play();
name = name.trim();
dispatchEvent(new CustomEvent('audio.start', {detail:name.replace(/\.([a-z0-9]{3})$/, '') || 'audio'}));
fireEvent('audio.start', name.replace(/\.([a-z0-9]{3})$/, '') || 'audio');
}
},
@ -89,7 +89,7 @@ export const SMAudio = new class {
pause() {
player && player.pause();
dispatchEvent(new CustomEvent('audio.stop'));
fireEvent('audio.stop');
}
playMp3(url, name) {

View file

@ -29,6 +29,8 @@ export const
return el;
},
fireEvent = (name, detail) => dispatchEvent(new CustomEvent(name, {detail:detail})),
// keys
keyScopeReal = ko.observable(Scope.All),
keyScope = value => {