@@ -52,18 +52,14 @@ class App extends PDFObject {
5252 ) ;
5353
5454 this . _timeoutIds = new WeakMap ( ) ;
55- if ( typeof FinalizationRegistry !== "undefined" ) {
56- // About setTimeOut/setInterval return values (specs):
57- // The return value of this method must be held in a
58- // JavaScript variable.
59- // Otherwise, the timeout object is subject to garbage-collection,
60- // which would cause the clock to stop.
61- this . _timeoutIdsRegistry = new FinalizationRegistry (
62- this . _cleanTimeout . bind ( this )
63- ) ;
64- } else {
65- this . _timeoutIdsRegistry = null ;
66- }
55+ // About setTimeOut/setInterval return values (specs):
56+ // The return value of this method must be held in a
57+ // JavaScript variable.
58+ // Otherwise, the timeout object is subject to garbage-collection,
59+ // which would cause the clock to stop.
60+ this . _timeoutIdsRegistry = new FinalizationRegistry (
61+ this . _cleanTimeout . bind ( this )
62+ ) ;
6763
6864 this . _timeoutCallbackIds = new Map ( ) ;
6965 this . _timeoutCallbackId = USERACTIVATION_CALLBACKID + 1 ;
@@ -113,12 +109,12 @@ class App extends PDFObject {
113109 const timeout = Object . create ( null ) ;
114110 const id = { callbackId, interval } ;
115111 this . _timeoutIds . set ( timeout , id ) ;
116- this . _timeoutIdsRegistry ? .register ( timeout , id ) ;
112+ this . _timeoutIdsRegistry . register ( timeout , id ) ;
117113 return timeout ;
118114 }
119115
120116 _unregisterTimeout ( timeout ) {
121- this . _timeoutIdsRegistry ? .unregister ( timeout ) ;
117+ this . _timeoutIdsRegistry . unregister ( timeout ) ;
122118
123119 const data = this . _timeoutIds . get ( timeout ) ;
124120 if ( ! data ) {
0 commit comments