This function below doesn't work on IE11, because IE11 is not supporting dispatchEvent and CustomEvent.
How can I convert this function to let it work on IE11?
I tried to add a variable which returns true/false if the browser is IE11, and based on that disable the dispatchEvent code. But that didn't work.
Any ideas how I can let this code work on IE11?
function disableLoader(dataElement) {
const dataElement = document[0].querySelector('[data-id]');
const dataElementId = dataElement.getAttribute('data-id');
dataElement.dispatchEvent(new CustomEvent('dataLoaded', {
detail: {
dataId: dataElementId,
status: 'finished'
}
}));
}