isMobile

Type:Function
Status:stable
Since:1.0.0
Platform:js
@blackbyte.sugar.js.is

Detect if is a mobile device (phone or tablet) Here’s the checklist we use:

  • has touch events
  • has orientation
  • max width 639px (to be improved)
  • pointer is coarse

Return

  1. -Boolean

    true if is a mobile, false if not

Example

import { isMobile } from '@blackbyte/sugar/is'
if (isMobile()) {
  // do something cool...
}

Todo

  • integrate some kind of media query checknormal
  • testsnormal