engelsystem/resources/assets/js/ready.js

11 lines
213 B
JavaScript

/**
* @param {Function} callback
*/
export const ready = (callback) => {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', callback);
} else {
callback();
}
};