1
- import map from '@bugsnag/core/lib/es-utils/map'
2
1
import reduce from '@bugsnag/core/lib/es-utils/reduce'
3
2
import filter from '@bugsnag/core/lib/es-utils/filter'
4
3
import { Client } from '@bugsnag/core'
@@ -96,12 +95,12 @@ export default (doc = document, win = window) => ({
96
95
97
96
// Proxy all the timer functions whose callback is their 0th argument.
98
97
// Keep a reference to the original setTimeout because we need it later
99
- const [ _setTimeout ] = map ( [
98
+ const [ _setTimeout ] = [
100
99
'setTimeout' ,
101
100
'setInterval' ,
102
101
'setImmediate' ,
103
102
'requestAnimationFrame'
104
- ] , fn =>
103
+ ] . map ( fn =>
105
104
__proxy ( win , fn , original =>
106
105
__traceOriginalScript ( original , ( args : any ) => ( {
107
106
get : ( ) => args [ 0 ] ,
@@ -112,13 +111,13 @@ export default (doc = document, win = window) => ({
112
111
)
113
112
114
113
// Proxy all the host objects whose prototypes have an addEventListener function
115
- map ( [
116
- 'EventTarget' , 'Window' , 'Node' , 'ApplicationCache' , 'AudioTrackList' , 'ChannelMergerNode' ,
117
- 'CryptoOperation' , 'EventSource' , 'FileReader' , 'HTMLUnknownElement' , 'IDBDatabase' ,
114
+ const eventListeners = [ 'EventTarget' , 'Window' , 'Node' , 'ApplicationCache' , 'AudioTrackList' , 'ChannelMergerNode' , 'CryptoOperation' , 'EventSource' , 'FileReader' , 'HTMLUnknownElement' , 'IDBDatabase' ,
118
115
'IDBRequest' , 'IDBTransaction' , 'KeyOperation' , 'MediaController' , 'MessagePort' , 'ModalWindow' ,
119
116
'Notification' , 'SVGElementInstance' , 'Screen' , 'TextTrack' , 'TextTrackCue' , 'TextTrackList' ,
120
117
'WebSocket' , 'WebSocketWorker' , 'Worker' , 'XMLHttpRequest' , 'XMLHttpRequestEventTarget' , 'XMLHttpRequestUpload'
121
- ] , o => {
118
+ ]
119
+
120
+ eventListeners . map ( o => {
122
121
// @ts -expect-error Element implicitly has an 'any' type because index expression is not of type 'number'
123
122
if ( ! win [ o ] || ! win [ o ] . prototype || ! Object . prototype . hasOwnProperty . call ( win [ o ] . prototype , 'addEventListener' ) ) return
124
123
// @ts -expect-error Element implicitly has an 'any' type because index expression is not of type 'number'
0 commit comments