This commit is contained in:
Danil Kovtonyuk 2022-04-22 13:05:56 +10:00
commit 44f31f8b9f
No known key found for this signature in database
GPG key ID: E72A919BF08C3746
402 changed files with 47865 additions and 0 deletions

37
utils/index.js Normal file
View file

@ -0,0 +1,37 @@
import FileSaver from 'file-saver'
export * from './crypto'
export * from './debounce'
export * from './adapters'
export * from './storeUtils'
export * from './stringUtils'
export * from './numberUtils'
export * from './instanceUtils'
export function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
export function detectMob() {
if (
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)
) {
return true
} else {
return false
}
}
export function saveAsFile(data, name) {
if (detectMob()) {
return
}
FileSaver.saveAs(data, name)
}