Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andrelmlins/svelte-device-detector
Render views on different device types
https://github.com/andrelmlins/svelte-device-detector
browser detector device os svelte
Last synced: about 5 hours ago
JSON representation
Render views on different device types
- Host: GitHub
- URL: https://github.com/andrelmlins/svelte-device-detector
- Owner: andrelmlins
- License: mit
- Created: 2020-05-29T03:56:13.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-07-19T04:11:05.000Z (over 1 year ago)
- Last Synced: 2024-10-28T17:33:25.709Z (19 days ago)
- Topics: browser, detector, device, os, svelte
- Language: JavaScript
- Size: 391 KB
- Stars: 19
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Svelte Device Detector
[![npm version](https://badge.fury.io/js/svelte-device-detector.svg)](https://www.npmjs.com/package/svelte-device-detector) • [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/andrelmlins/svelte-device-detector/blob/master/LICENSE) • [![Build Status](https://travis-ci.com/andrelmlins/svelte-device-detector.svg?branch=master)](https://travis-ci.com/andrelmlins/svelte-device-detector)
Render views on different device types.
## Installation
```
npm i svelte-device-detector
// OR
yarn add svelte-device-detector
```Note: to use this library in sapper, install as devDependency. See the [link](https://github.com/sveltejs/sapper-template#using-external-components).
## Demo
Local demo:
```
git clone https://github.com/andrelmlins/svelte-device-detector.git
cd svelte-device-detector
npm install && npm run dev
```## Examples
An example of how to use the library:
```js
import DeviceDetector from "svelte-device-detector";
Desktop
Mobile and Chrome
Safari or Firefox
```
## Properties
For best results the values have these characteristics:
- Ignores sensitive case
- Ignore special character
- Removing accents
- Skips space| Prop | Default | Type | Description |
| ------------- | ------- | ----------------- | --------------------------------------- |
| showInDevice | - | `string`, `array` | Render view on device types |
| showInBrowser | - | `string`, `array` | Render view on browser types |
| showInOs | - | `string`, `array` | Render view on operational system types |## NPM Statistics
Download stats for this NPM package
[![NPM](https://nodei.co/npm/svelte-device-detector.png)](https://nodei.co/npm/svelte-device-detector/)
## License
Svelte Device Detector is open source software [licensed as MIT](https://github.com/andrelmlins/svelte-device-detector/blob/master/LICENSE).