@@ -109,9 +109,9 @@ async function uploadVideo(videoJSON: Video) {
109
109
await fileChooser . accept ( [ pathToFile ] )
110
110
111
111
// Setup onProgress
112
- let progressChecker : NodeJS . Timer | undefined
112
+ let progressChecker : any
113
113
let progress : VideoProgress = { progress : 0 , stage : ProgressEnum . Uploading } ;
114
- if ( videoJSON . onProgress )
114
+ if ( videoJSON . onProgress ) {
115
115
videoJSON . onProgress ( progress )
116
116
progressChecker = setInterval ( async ( ) => {
117
117
let curProgress = await page . evaluate ( ( ) => {
@@ -121,13 +121,14 @@ async function uploadVideo(videoJSON: Video) {
121
121
return items . item ( i ) . textContent ;
122
122
}
123
123
} )
124
- if ( ! progressChecker || ! curProgress ) return
125
- curProgress = curProgress . split ( " " ) . find ( txt => txt . indexOf ( "%" ) != - 1 )
124
+ if ( progressChecker == undefined || ! curProgress ) return
125
+ curProgress = curProgress . split ( " " ) . find ( ( txt : string ) => txt . indexOf ( "%" ) != - 1 )
126
126
let newProgress = curProgress ? parseInt ( curProgress . slice ( 0 , - 1 ) ) : 0
127
127
if ( progress . progress == newProgress ) return
128
128
progress . progress = newProgress
129
129
videoJSON . onProgress ! ( progress )
130
130
} , 500 )
131
+ }
131
132
// Wait for upload to complete
132
133
await page . waitForXPath ( '//*[contains(text(),"Upload complete")]' , { timeout : 0 } )
133
134
if ( videoJSON . onProgress ) {
0 commit comments