@@ -11,8 +11,11 @@ export class StackItem {
1111 /** @type {Required<import('./types.package').StackItemInstanceConfig<string, UserComponent>> } */
1212 config ;
1313
14+ /** @type {number } */
15+ // eslint-disable-next-line no-undef
16+ msToTimeout = $state ( 0 ) ;
17+
1418 #internals = {
15- msToTimeout : 0 ,
1619 /** @type {ReturnType<typeof setTimeout> | undefined } */
1720 timeoutId : undefined ,
1821 lastStartedTime : new Date ( ) . getTime ( ) ,
@@ -30,29 +33,29 @@ export class StackItem {
3033 */
3134 constructor ( config ) {
3235 this . config = config ;
33- this . #internals . msToTimeout = config . timeout ;
36+ this . msToTimeout = config . timeout ;
3437
3538 this . resolution = new Promise ( ( resolve ) => {
3639 this . #internals. resolve = resolve ;
3740 } ) ;
3841 }
3942
4043 resume = ( ) => {
41- if ( this . #internals . msToTimeout <= 0 || this . state === 'elapsing' ) return ;
44+ if ( this . msToTimeout <= 0 || this . state === 'elapsing' ) return ;
4245 clearTimeout ( this . #internals. timeoutId ) ;
4346 this . #internals. lastStartedTime = new Date ( ) . getTime ( ) ;
4447 this . #internals. timeoutId = setTimeout ( async ( ) => {
45- this . #internals . msToTimeout = 0 ;
48+ this . msToTimeout = 0 ;
4649 await this . resolve ( ) ;
4750 this . state = 'timeout' ;
48- } , this . #internals . msToTimeout ) ;
51+ } , this . msToTimeout ) ;
4952 this . state = 'elapsing' ;
5053 } ;
5154
5255 pause = ( ) => {
5356 if ( this . state === 'paused' || this . state === 'idle' ) return ;
5457 clearTimeout ( this . #internals. timeoutId ) ;
55- this . #internals . msToTimeout -= new Date ( ) . getTime ( ) - this . #internals. lastStartedTime ;
58+ this . msToTimeout -= new Date ( ) . getTime ( ) - this . #internals. lastStartedTime ;
5659 this . state = 'paused' ;
5760 } ;
5861
0 commit comments