masto-fe/app/javascript/mastodon/ready.js
2017-11-17 19:29:16 -08:00

7 lines
197 B
JavaScript

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