Updated Readme to include typescript import

pull/277/head
Alexander Cerutti 5 years ago committed by GitHub
parent 3d63c268f4
commit e17180a6a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,14 +20,15 @@ The upcoming 2.0 version has drastically changed API. All available methods can
# Use cases
First of all, require the library:
First of all, require the library. This is a UMD Module, so it will work for AMD, Typescript and CommonJS module systems.
```javascript
const bowser = require('bowser');
const Bowser = require('bowser'); // CommonJS
import Bowser = require('bowser'); // Typescript
```
By default, `require('bowser')` requires the *ES5 version of files*, which
**do not** include any polyfills.
By default, the exported version is the *ES5 transpiled version*, which **do not** include any polyfills.
In case you don't use your own `babel-polyfill` you may need to have pre-built bundle with all needed polyfills.
So, for you it's suitable to require bowser like this: `require('bowser/bundled')`.
@ -63,6 +64,7 @@ or
const browser = bowser.getParser(window.navigator.userAgent);
impression.userTechData = browser.parse();
console.log(impression.userTechData);
// outputs
{
browser: {

Loading…
Cancel
Save