cerebral-module-useragent
install
NPM
npm install cerebral-module-useragent@next --save --save-exact
YARN
yarn add cerebral-module-useragent@next --exact
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-module-useragent'
const controller = Controller({
modules: {
useragent: Useragent({
media: {
small: '(min-width: 600px)',
medium: '(min-width: 1024px)',
large: '(min-width: 1440px)',
portrait: '(orientation: portrait)'
},
feature: true,
parse: {
browser: true,
device: true
},
offline: {
checkOnLoad: false,
interceptRequests: true,
reconnect: {
initialDelay: 3,
delay: 1.5
},
requests: false
},
window: true
})
}
})