From e17180a6a8ad8ca5e7e38ee79f9bc074faa93ca1 Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Fri, 11 Jan 2019 23:41:59 +0100 Subject: [PATCH] Updated Readme to include typescript import --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1af61be..7e96640 100644 --- a/README.md +++ b/README.md @@ -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: {