chore: Refactor audio notification helper (#6148)

This commit is contained in:
Pranav Raj S
2022-12-29 20:01:14 -08:00
parent 297e144f33
commit 6ffb7fe34e
10 changed files with 131 additions and 273 deletions

View File

@@ -16,11 +16,6 @@ import App from '../dashboard/App';
import i18n from '../dashboard/i18n';
import createAxios from '../dashboard/helper/APIHelper';
import commonHelpers, { isJSONValid } from '../dashboard/helper/commons';
import {
getAlertAudio,
initOnEvents,
} from '../shared/helpers/AudioNotificationHelper';
import { initFaviconSwitcher } from '../shared/helpers/faviconHelper';
import router, { initalizeRouter } from '../dashboard/routes';
import store from '../dashboard/store';
import constants from '../dashboard/constants';
@@ -93,17 +88,6 @@ window.onload = () => {
}).$mount('#app');
};
const setupAudioListeners = () => {
getAlertAudio().then(() => {
initOnEvents.forEach(event => {
document.removeEventListener(event, setupAudioListeners, false);
});
});
};
window.addEventListener('load', () => {
window.playAudioAlert = () => {};
initOnEvents.forEach(e => {
document.addEventListener(e, setupAudioListeners, false);
});
initFaviconSwitcher();
});