@@ -2,33 +2,33 @@ import { registerPolyfills } from "./shared/polyfill-global";
2
2
3
3
declare const __console_proxy : Console ;
4
4
5
- const EOL = "\n" ;
6
-
7
- function handleTimerCbError ( e : unknown , type : string , stack ?: string ) {
8
- const stackFmtd = stack
9
- ? __console_proxy . formatStackTrace (
10
- __console_proxy . mapStackTrace ( stack ) ,
11
- 2 ,
12
- )
13
- : "Stack trace not available" ;
14
- __console_proxy . error (
15
- e ,
16
- `${ EOL } ${ EOL } The above error occured in a callback provided to ${ type } in here:${ EOL } ${ stackFmtd } ` ,
17
- ) ;
18
- }
19
-
20
- function runWithErrorHandler ( cb : Function , type : string , stack ?: string ) {
21
- try {
22
- const res = cb ( ) ;
23
- if ( res instanceof Promise ) {
24
- res . catch ( ( e ) => handleTimerCbError ( e , type , stack ) ) ;
5
+ registerPolyfills ( "queueMicrotask" ) ( ( ) => {
6
+ const EOL = "\n" ;
7
+
8
+ function handleTimerCbError ( e : unknown , type : string , stack ?: string ) {
9
+ const stackFmtd = stack
10
+ ? __console_proxy . formatStackTrace (
11
+ __console_proxy . mapStackTrace ( stack ) ,
12
+ 2 ,
13
+ )
14
+ : "Stack trace not available" ;
15
+ __console_proxy . error (
16
+ e ,
17
+ `${ EOL } ${ EOL } The above error occured in a callback provided to ${ type } in here:${ EOL } ${ stackFmtd } ` ,
18
+ ) ;
19
+ }
20
+
21
+ function runWithErrorHandler ( cb : Function , type : string , stack ?: string ) {
22
+ try {
23
+ const res = cb ( ) ;
24
+ if ( res instanceof Promise ) {
25
+ res . catch ( ( e ) => handleTimerCbError ( e , type , stack ) ) ;
26
+ }
27
+ } catch ( e ) {
28
+ handleTimerCbError ( e , type , stack ) ;
25
29
}
26
- } catch ( e ) {
27
- handleTimerCbError ( e , type , stack ) ;
28
30
}
29
- }
30
31
31
- registerPolyfills ( "queueMicrotask" ) ( ( ) => {
32
32
let onNextMicrotask : Array < ( ) => void > | undefined ;
33
33
34
34
function queueMicrotask ( task : ( ) => void ) {
0 commit comments