In Sage 10 (not sure if it was already there in previous versions) there is a utils.js with the code:
/**
* Execute a function when the DOM is fully loaded.
*
* @param {function} fn
*/
export const ready = fn => document.readyState !== 'loading'
? window.setTimeout(fn, 0)
: document.addEventListener('DOMContentLoaded', fn);
How would I be able to use it? I tried creating a function in utils.js and app.js named “DOMContentLoaded” yet I doesn’t seem to get triggered when the page loads.
Anyone has tip/hint on what I’m missing here?
Thanks