{"id":16318059,"url":"https://github.com/willviles/ember-useragent","last_synced_at":"2025-03-16T14:30:55.762Z","repository":{"id":18893253,"uuid":"81572801","full_name":"willviles/ember-useragent","owner":"willviles","description":"An Ember addon for Fastboot-enabled UserAgent parsing via UAParser.js.","archived":false,"fork":false,"pushed_at":"2023-01-27T10:52:07.000Z","size":4046,"stargazers_count":37,"open_issues_count":16,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-21T04:46:47.982Z","etag":null,"topics":["browser-detection","device-detector","device-recognition","ember","ember-addon","ember-fastboot","mobile-detection","ua-parser","useragent"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/willviles.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-10T14:27:30.000Z","updated_at":"2024-05-30T02:34:40.000Z","dependencies_parsed_at":"2023-02-15T08:16:49.570Z","dependency_job_id":null,"html_url":"https://github.com/willviles/ember-useragent","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-useragent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-useragent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-useragent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/willviles%2Fember-useragent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/willviles","download_url":"https://codeload.github.com/willviles/ember-useragent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243818195,"owners_count":20352629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-detection","device-detector","device-recognition","ember","ember-addon","ember-fastboot","mobile-detection","ua-parser","useragent"],"created_at":"2024-10-10T22:09:51.824Z","updated_at":"2025-03-16T14:30:55.200Z","avatar_url":"https://github.com/willviles.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Ember UserAgent [![Build Status](https://travis-ci.org/willviles/ember-useragent.svg)](https://travis-ci.org/willviles/ember-useragent) [![Ember Observer Score](http://emberobserver.com/badges/ember-useragent.svg)](http://emberobserver.com/addons/ember-useragent) ![Download count all time](https://img.shields.io/npm/dt/ember-useragent.svg) [![npm](https://img.shields.io/npm/v/ember-useragent.svg)](https://www.npmjs.com/package/ember-useragent)\n======\n\nEmber UserAgent is an Ember Addon for UserAgent parsing via [UAParser.js](https://github.com/faisalman/ua-parser-js).\n\nThe `userAgent` service works in both browser \u0026 Fastboot environments and makes it easy to detect:\n\n* **Device Type**\n* **Device Model**\n* **Browser**\n* **Operating System**\n* **Layout Engine**\n* **CPU architecture**\n\n\nCompatibility\n------------------------------------------------------------------------------\n\n* Ember.js v3.8 or above\n* Ember CLI v2.13 or above\n* Node.js v8 or above\n\n\nInstallation\n------------------------------------------------------------------------------\n\n```\nember install ember-useragent\n```\n\n## Usage\n\nEmber UserAgent exposes a service and a template helper.\n\n### Service\n\n```javascript\nimport { inject as service } from '@ember/service';\n\nexport default class FooComponent extends Component {\n  @service userAgent;\n}\n```\n\n```javascript\nconst userAgent = this.get('userAgent');\n\nuserAgent.get('browser.isChrome'); // Boolean\nuserAgent.get('engine.isWebKit'); // Boolean\nuserAgent.get('os.info'); // =\u003e { name: 'Ubuntu', version: '11.10' }\nuserAgent.get('device.info'); // =\u003e { model: 'iPhone 7', type: 'mobile', vendor: 'Apple'}\n```\n\n### Helper\n\n```handlebars\n{{#if (user-agent \"browser.isChrome\")}}\n  Chrome, here...\n{{/if}}\n```\n\n### Service Properties\n\nThe service exposes all of UAParser's functions, but also adds some properties for quick access.\n\n| browser          | device    | engine   | os        | cpu          |\n|------------------|-----------|----------|-----------|--------------|\n| info             | info      | info     | info      | architecture |\n| isChrome         | isConsole | isWebKit | isAndroid |              |\n| isChromeHeadless | isDesktop |          | isIOS     |              |\n| isEdge           | isMobile  |          | isLinux   |              |\n| isFirefox        | isTablet  |          | isMacOS   |              |\n| isIE             |           |          | isWindows |              |\n| isSafari         |           |          |           |              |\n\nThe service also exposes the `userAgent` property, which contains the user agent string.\nYou can overwrite this property, if you want to force a certain user agent string.\nAll of the properties described above will update in accordance.\n\n### Manual Usage\n\nEmber UserAgent auto imports `ua-parser-js` into your application using [ember-auto-import](https://github.com/ef4/ember-auto-import):\n\n```js\nimport UAParser from 'ua-parser-js';\n```\n\n### Injection\n\nPrior to `0.11.0`, this addon generated an initializer in `app/initializers/user-agent.js` that injected the `userAgent` service across all controllers, components and routes. This does not happen in `\u003e=0.11.0`.\n\nYou can restore this behavior by manually performing these implicit injections (see [#42](https://github.com/willviles/ember-useragent/pull/42)), however this is highly discouraged, as this feature is deprecated by the upcoming Ember `v4.0`. If you were relying on these implicit injections, you should instead refactor your code to explicitly inject the `userAgent` service.\n\n## Using UAParser.js\n\nFor more information on how to use UAParser.js, please refer to the [documentation](https://github.com/faisalman/ua-parser-js#methods).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-useragent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwillviles%2Fember-useragent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwillviles%2Fember-useragent/lists"}