
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
cerebral-module-useragent
Advanced tools
Adds useragent specs to your cerebral state model
A Cerebral module for everything user agent.
This package is compatible with Cerebral 1.x. The current cerebral-module-useragent package for Cerebral 2 has moved to the Cerebral Monorepo.
React view package for Cerebral
Go to http://www.cerebraljs.com/documentation/cerebral-module-useragent
I am using the ua-parser-js package to parse navigator.userAgent. Currently only the browser, device and OS parts are stored in the model, because I didn't see any use for cpu and engine.
The window resize event is just slightly throttled using requestAnimationFrame(). I might make this configurable to use a stronger throttle timeout if it proofs to be too resource hungry.
The media queries are tested with matchMedia() so you should be able to use any valid CSS media query.
I am using the feature.js package to detect browser features. Please checkout the website to see a list of all supported feature tests.
You can also only store certain test results in the model or define your own tests.
const useragent = Useragent({
feature: {
touch: true,
serviceWorker: true,
getUserMedia: () => !!navigator.getUserMedia
}
})
All tests from
feature.jsare executed even if you set the feature option to false. This is a limitation of the library.
I am using the offline-js package to detect internet connectivity. The application is initially assumed to be online.
Fork repo
npm installcd demo and npm installnpm start runs the demo which is currently used for testingnpm lint lint with JavaScript Standard Stylenpm run build compiles es6 to es5No tests yet. Feel free to issue a pull request if you want this.
FAQs
Adds useragent specs to your cerebral state model
The npm package cerebral-module-useragent receives a total of 0 weekly downloads. As such, cerebral-module-useragent popularity was classified as not popular.
We found that cerebral-module-useragent demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.