Long story short, I'll show the code.
some.html
<html><script src="some.js"></script></html> some.js
window.onload = () => console.log( "onload" ); (async (url, cb) => cb( await ( await fetch(url) ).json() )) ( "some.json", () => console.log( "in async" ) ); and some.html outputs:
onload in async I've done some works e.g. image loading in real fetch, so fetch().then() doesn't work for me.
Now my question is as title says, how can I let "onload" waiting for "fetch" complete?
fetch().then()work for 'you'?window.onload = () => console.log( "onload" );. that sets the onload handler function ... the rest is completely separate codethencatch this?