You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If it were mandated that the data cache script appears in HTML before the JS which renders the page, the need for preloadData() would be removed.
The use case for preloadData() is to allow including JS scripts in document head with async or defer. In that case the JS could execute before data is loaded.
However, this can be better achieved using <link rel="preload">:
<link rel="preload"> gets the script loading asap, but the JS is guaranteed not to execute until after the data is available. This would still work if the JS <script> tag has async attribute, as long as it's below the data cache script.
The text was updated successfully, but these errors were encountered:
If it were mandated that the data cache script appears in HTML before the JS which renders the page, the need for
preloadData()
would be removed.The use case for
preloadData()
is to allow including JS scripts in document head withasync
ordefer
. In that case the JS could execute before data is loaded.However, this can be better achieved using
<link rel="preload">
:<link rel="preload">
gets the script loading asap, but the JS is guaranteed not to execute until after the data is available. This would still work if the JS<script>
tag hasasync
attribute, as long as it's below the data cache script.The text was updated successfully, but these errors were encountered: