File tree Expand file tree Collapse file tree
Source/Workbench/Electron Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,6 +63,31 @@ console.log(
6363) ;
6464
6565// Stubs for APIs that VS Code uses but don't exist in Tauri's WKWebView.
66+
67+ // requestIdleCallback/cancelIdleCallback: WKWebView doesn't support these.
68+ // VS Code uses them in workbench.js for deferred canvas cleanup and other
69+ // non-critical tasks. Without this polyfill, the workbench crashes on load.
70+ if ( typeof window . requestIdleCallback !== "function" ) {
71+ ( window as any ) . requestIdleCallback = (
72+ Callback : IdleRequestCallback ,
73+ Options ?: IdleRequestOptions ,
74+ ) : number => {
75+ const Timeout = Options ?. timeout ?? 1 ;
76+ const Start = Date . now ( ) ;
77+ return setTimeout ( ( ) => {
78+ Callback ( {
79+ didTimeout : Timeout <= 0 ,
80+ timeRemaining : ( ) => Math . max ( 0 , Timeout - ( Date . now ( ) - Start ) ) ,
81+ } ) ;
82+ } , Timeout ) as unknown as number ;
83+ } ;
84+ }
85+ if ( typeof window . cancelIdleCallback !== "function" ) {
86+ ( window as any ) . cancelIdleCallback = ( Id : number ) : void => {
87+ clearTimeout ( Id ) ;
88+ } ;
89+ }
90+
6691// queryLocalFonts: VS Code's fonts.js calls mainWindow.queryLocalFonts() to
6792// enumerate system fonts. Returns empty array = VS Code falls back to defaults.
6893if ( typeof ( window as any ) . queryLocalFonts !== "function" ) {
You can’t perform that action at this time.
0 commit comments