Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/state / src / deps.ts
Size: Mime:
import { isObj } from 'exotic'

export function isTouchDevice() {
  return isObj(document.documentElement) && 'ontouchstart' in document.documentElement
}

/**
 * @see https://stackoverflow.com/questions/33152523/how-do-i-detect-ie-and-edge-browser?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
 */
export function isEdgeOrInternetExplorer() {
  if (typeof window === 'object' && typeof document === 'object' && typeof navigator === 'object') {
    return document.documentMode || /Edge/.test(navigator.userAgent)
  } else if (typeof global === 'object') {
    if (isObj(global.oneUrl)) {
      return /Edge/.test(global.oneUrl.userAgent as string)
    } else {
      console.warn('application: isEdgeOrInternetExplorer is triggered before global.oneUrl')
      return false
    }
  } else {
    console.warn('could not determine isEdgeOrInternetExplorer')
    return false
  }
}