File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 11// This script is for critical JS that needs to run as soon as possible.
2- // Do not import any dependencies and keep to vanilla JS only.
2+
3+ let attempts = 0 ;
4+ requestAnimationFrame ( function wait ( ) {
5+ if ( document . querySelector ( 'script[src*="index.js"]' ) || ++ attempts > 100 ) return init ( ) ;
6+ requestAnimationFrame ( wait ) ;
7+ } ) ;
38
49// This function runs before DOMContentLoaded and checks if most of the page
510// has loaded so we can do DOM mutations before anything is painted on the screen.
6- requestAnimationFrame ( function init ( elapsed ) {
7- if ( elapsed > 10000 ) return ;
8- if ( ! document . querySelector ( 'script[src*="index.js"]' ) ) return requestAnimationFrame ( init ) ;
9-
11+ function init ( ) {
1012 // Synchronously set clone button states and urls here to avoid flickering
1113 // on page load. initRepoCloneLink calls this when proto changes.
1214 // this applies the protocol-dependant clone url to all elements with the
@@ -32,4 +34,4 @@ requestAnimationFrame(function init(elapsed) {
3234 el . href = `vscode://vscode.git/clone?url=${ encodeURIComponent ( link ) } ` ;
3335 }
3436 } ) ( ) ;
35- } ) ;
37+ }
You can’t perform that action at this time.
0 commit comments