engelsystem/resources/assets/js/ready.js

11 lines
213 B
JavaScript
Raw Normal View History

2022-12-10 14:56:10 +01:00
/**
* @param {Function} callback
*/
2022-11-29 19:19:30 +01:00
export const ready = (callback) => {
2023-04-01 15:14:32 +02:00
if (document.readyState === 'loading') {
2022-11-29 19:19:30 +01:00
document.addEventListener('DOMContentLoaded', callback);
2023-04-01 15:14:32 +02:00
} else {
callback();
2022-11-29 19:19:30 +01:00
}
2022-12-22 18:28:51 +01:00
};