mastodon/app/javascript/themes/glitch/util/ready.js
2017-11-17 19:29:16 -08:00

8 lines
197 B
JavaScript

export default function ready(loaded) {
if (['interactive', 'complete'].includes(document.readyState)) {
loaded();
} else {
document.addEventListener('DOMContentLoaded', loaded);
}
}