File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -196,7 +196,10 @@ class CanvasImageElement {
196
196
class CanvasElement {
197
197
constructor (
198
198
private canvasContext : IMiniProgramCanvasContext_v1 ,
199
- private _addCallIdAction : ( ) => void
199
+ private _addCallIdAction : ( ) => void ,
200
+ private offscreenCanvas = ( my as any ) . createOffscreenCanvas
201
+ ? ( my as any ) . createOffscreenCanvas ( )
202
+ : { requestAnimationFrame : ( ) => { } }
200
203
) {
201
204
202
205
}
@@ -205,10 +208,8 @@ class CanvasElement {
205
208
}
206
209
requestAnimationFrame ( fn : any ) {
207
210
const frameFn = bindDrawRunnable ( fn , this . canvasContext , this . _addCallIdAction ) ;
208
- const offscreenCanvas = ( my as any ) . createOffscreenCanvas
209
- ? ( my as any ) . createOffscreenCanvas ( )
210
- : { requestAnimationFrame : ( ) => { } } ;
211
- return offscreenCanvas . requestAnimationFrame ( ( ) => {
211
+
212
+ return this . offscreenCanvas . requestAnimationFrame ( ( ) => {
212
213
frameFn ( Date . now ( ) ) ;
213
214
} ) ;
214
215
}
You can’t perform that action at this time.
0 commit comments