2 ms·
Promises are actually bad for that use case because you want the completion callback to run synchronously on load, otherwise, foreign code may trample a global
by pygy_ 10y ago
Promises are actually bad for that use case because you want the completion callback to run synchronously on load, otherwise, foreign code may trample a global between the time the script loads and the time the 'loaded' function runs.
This may not be an issue with native ES6 Promises (since they rely on microtasks) but other implementations/polyfills may not be airtight (setTimeout-based ones aren't for sure, for example).