about summary refs log tree commit diff
path: root/app/javascript/themes/glitch/util/ready.js
blob: dd543910bb0ea5f8bd1ca8214a03fd3be1a5fe1d (plain) (blame)
1
2
3
4
5
6
7
export default function ready(loaded) {
  if (['interactive', 'complete'].includes(document.readyState)) {
    loaded();
  } else {
    document.addEventListener('DOMContentLoaded', loaded);
  }
}