File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -186,8 +186,11 @@ export function drawImageInCanvas(img) {
186
186
* see: https://stackoverflow.com/a/9039885
187
187
* @returns {boolean } isIOS device
188
188
*/
189
- function isIOS ( ) {
190
- return [
189
+ export function isIOS ( ) {
190
+ if ( isIOS . cachedResult !== undefined ) {
191
+ return isIOS . cachedResult ;
192
+ }
193
+ isIOS . cachedResult = [
191
194
'iPad Simulator' ,
192
195
'iPhone Simulator' ,
193
196
'iPod Simulator' ,
@@ -197,6 +200,7 @@ function isIOS() {
197
200
] . includes ( navigator . platform )
198
201
// iPad on iOS 13 detection
199
202
|| ( navigator . userAgent . includes ( 'Mac' ) && 'ontouchend' in document ) ;
203
+ return isIOS . cachedResult ;
200
204
}
201
205
202
206
/**
@@ -213,6 +217,9 @@ export async function drawFileInCanvas(file) {
213
217
}
214
218
img = await createImageBitmap ( file ) ;
215
219
} catch ( e ) {
220
+ if ( process . env . BUILD === 'development' ) {
221
+ console . error ( e ) ;
222
+ }
216
223
const dataUrl = await getDataUrlFromFile ( file ) ;
217
224
img = await loadImage ( dataUrl ) ;
218
225
}
You can’t perform that action at this time.
0 commit comments