0.3.2 • Published 5 years ago

@xg4/device v0.3.2

Weekly downloads
17
License
MIT
Repository
github
Last release
5 years ago

Device

device detection (phone, tablet, desktop, os)

Build Status codecov npm GitHub

Installation

Install with npm or Yarn

# npm
$ npm install @xg4/device --save
# yarn
$ yarn add @xg4/device

Usage

// commonjs in node or browser
const Device = require('@xg4/device').default

// es module
import Device from '@xg4/device'

const device = new Device() // or new Device(userAgent)

Instance Properties

namedescription
typedevice type (mobile, tablet, desktop, null)
osdevice os (ios, android, blackberry, mac, windows, firefox, meego, tv, null)

Instance Methods

namedescriptionreturn
isMac/Boolean
isIphone/Boolean
isIpod/Boolean
isIpad/Boolean
isIos/Boolean
isWindows/Boolean
isWindowsPhone/Boolean
isWindowsTablet/Boolean
isAndroid/Boolean
isAndroidPhone/Boolean
isAndroidTablet/Boolean
isBlackberry/Boolean
isBlackberryPhone/Boolean
isBlackberryTablet/Boolean
isFirefoxfirefox os, not browserBoolean
isFirefoxPhonefirefox os, not browserBoolean
isFirefoxTabletfirefox os, not browserBoolean
isMeego/Boolean
isCordova/Boolean
isNode/Boolean
isMobile/Boolean
isTablet/Boolean
isDesktop/Boolean
isTv/Boolean

Screen Orientation

// commonjs in node or browser
const Orientation = require('@xg4/device').Orientation

// es module
import { Orientation } from '@xg4/device'

const orientation = new Orientation()

orientation.listen(function(event, type) {
  // type === 'landscape' || 'portrait'
})

Orientation Instance Properties

  • type: 'landscape' || 'portrait'

Orientation Instance Methods

  • isPortrait: Boolean

  • isLandscape: Boolean

  • listen: void

Contributing

Welcome

  • Fork it

  • Submit pull request

LICENSE

MIT

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago