catstodon/app/javascript/flavours/glitch/util/ready.js
2017-12-03 23:26:40 -08:00

7 lines
197 B
JavaScript

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