Skip to content

Commit 1782487

Browse files
committed
Fix monaco compile checks, fallback to setTimeout
1 parent 7c1dd74 commit 1782487

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/vs/base/browser/performance.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ export namespace inputLatency {
115115
if (state.selection !== EventPhase.Finished || state.render !== EventPhase.Finished) {
116116
return;
117117
}
118-
// Finish the recording, using setImmediate to ensure that layout/paint is captured
119-
setImmediate(() => {
118+
// Finish the recording, use a timer to ensure that layout/paint is captured. setImmediate
119+
// is used if available (Electron) to get slightly more accurate results
120+
('setImmediate' in window ? (window as any).setImmediate : setTimeout)(() => {
120121
if (state.keydown === EventPhase.Finished && state.input === EventPhase.Finished && state.selection === EventPhase.Finished && state.render === EventPhase.Finished) {
121122
performance.mark('inputlatency/end');
122123

@@ -142,7 +143,7 @@ export namespace inputLatency {
142143

143144
reset();
144145
}
145-
});
146+
}, 0);
146147
}
147148

148149
/**

0 commit comments

Comments
 (0)