mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-17 15:35:27 +03:00
Merge pull request #11 from jbuck/requirejs
Add requirejs module support
This commit is contained in:
11
readme.md
11
readme.md
@@ -75,6 +75,17 @@ Extract detailed type of web browser, layout engine, operating system, and devic
|
|||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using requirejs
|
||||||
|
|
||||||
|
If you're using requirejs, you can load UA-Parser like any other module.
|
||||||
|
|
||||||
|
```js
|
||||||
|
require(['ua-parser'], function(UAParser) {
|
||||||
|
var parser = new UAParser();
|
||||||
|
console.log(parser.getResult());
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Using node.js
|
## Using node.js
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|||||||
@@ -417,6 +417,11 @@
|
|||||||
exports = module.exports = UAParser;
|
exports = module.exports = UAParser;
|
||||||
}
|
}
|
||||||
exports.UAParser = UAParser;
|
exports.UAParser = UAParser;
|
||||||
|
} else if (typeof define === 'function' && define.amd) {
|
||||||
|
// requirejs env
|
||||||
|
define(function() {
|
||||||
|
return UAParser;
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
// browser env
|
// browser env
|
||||||
global.UAParser = UAParser;
|
global.UAParser = UAParser;
|
||||||
|
|||||||
Reference in New Issue
Block a user