engelsystem/resources/assets/js/ready.js

11 lines
212 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) => {
if (document.readyState !== 'loading') {
callback();
} else {
document.addEventListener('DOMContentLoaded', callback);
}
}