@ima/plugin-useragent
v6.0.3
Published
Seznam IMA.js plugin user-agent
Downloads
63
Readme
@ima/plugin-useragent
Installation
npm install @ima/plugin-useragent --save
// /app/build.js
var vendors = {
common: [
'@ima/plugin-useragent'
]
};
/*
Now is plugin UserAgent available from:
ns.ima.plugin.userAgent.PlatformJS;
ns.ima.plugin.userAgent.ClientUserAgent;
ns.ima.plugin.userAgent.ServerUserAgent;
ns.ima.plugin.userAgent.UserAgent;
import { PlatformJS, ClientUserAgent, ServerUserAgent, UserAgent } from '@ima/plugin-useragent';
*/
// /app/config/bind.js
import { UserAgent } from '@ima/plugin-useragent';
oc.bind('UserAgent', UserAgent);
##Usage
// /app/config/bind.js
oc.bind('Foo', ns.App.Foo, ['UserAgent']);
// /app/foo.js
class Foo {
constructor(userAgent) {
...
var os = userAgent.getOSFamily();
var browser = userAgent.getName();
var version = userAgent.getVersion();
if (version !== 'unknown' ) {
browser += version;
}
var os = userAgent.getOSFamily();
...
}
}