3.2.2 • Published 7 years ago

@cerebral/useragent v3.2.2

Weekly downloads
38
License
MIT
Repository
github
Last release
7 years ago

@cerebral/useragent

Install

NPM

npm install @cerebral/useragent

Description

The useragent module puts information about the browser into your state tree, and it also updates this information when this information changes.

  • UA parser: browser and device
  • Window: size & orientation
  • Media queries
  • Feature detection
  • Internet connectivity

Instantiate

import {Controller} from 'cerebral'
import Useragent from '@cerebral/useragent'

const controller = Controller({
  modules: {
    useragent: Useragent({
      // Use CSS media queries to determine
      // custom sizes available in your model.
      // They will be toggle between true/false in your
      // model
      media: {
        small: '(min-width: 600px)',
        medium: '(min-width: 1024px)',
        large: '(min-width: 1440px)',
        portrait: '(orientation: portrait)'
      },

      // store all feature tests in model
      feature: true,

      parse: {
        // parse useragent.browser from ua string
        browser: true,
        // parse useragent.device from ua string
        device: true
      },

      // check the docs at: https://github.com/HubSpot/offline#advanced
      offline: {
        checkOnLoad: false,
        interceptRequests: true,
        reconnect: {
          initialDelay: 3,
          delay: 1.5
        },
        requests: false
      },

      // update window size on resize
      window: true
    })
  }
})
3.2.2

7 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.1.1

7 years ago

3.1.0

7 years ago

3.0.1

7 years ago

3.0.0

7 years ago

2.6.0

8 years ago

2.5.0

8 years ago

2.4.0

8 years ago

2.3.0

8 years ago

2.2.0

8 years ago

2.1.0

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.0.0-beta.3

8 years ago

0.0.0-beta.2

8 years ago

0.0.0-beta.1

8 years ago