GithubHelp home page GithubHelp logo

hugovg / blazorcurrentdevice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arivera12/blazorcurrentdevice

0.0 0.0 0.0 1.05 MB

Device detection for blazor using current-device.js

License: MIT License

C# 44.72% CSS 13.52% HTML 41.77%

blazorcurrentdevice's Introduction

BlazorCurrentDevice

Device detection for blazor using current-device.js

Installation

Install-Package BlazorCurrentDevice -Version 1.0.7

Add reference in _Imports.razor

@using BlazorCurrentDevice

Add the service in your services method

services.AddBlazorCurrentDevice();

Add javascript library reference in your index.html or _Host.cshtml

<script src="_content/BlazorCurrentDevice/current-device.min.js"></script>

Usage

[Inject] IBlazorCurrentDeviceService BlazorCurrentDeviceService { get; set; } or

@inject IBlazorCurrentDeviceService BlazorCurrentDeviceService

Device Methods

BlazorCurrentDeviceService Method
Mobile BlazorCurrentDeviceService.Mobile()
Tablet BlazorCurrentDeviceService.Tablet()
Desktop BlazorCurrentDeviceService.Desktop()
iOS BlazorCurrentDeviceService.iOS()
iPad BlazorCurrentDeviceService.iPad()
iPhone BlazorCurrentDeviceService.iPhone()
iPod BlazorCurrentDeviceService.iPod()
Android BlazorCurrentDeviceService.Android()
Android Phone BlazorCurrentDeviceService.AndroidPhone()
Android Tablet BlazorCurrentDeviceService.AndroidTablet()
BlackBerry BlazorCurrentDeviceService.Blackberry()
BlackBerry Phone BlazorCurrentDeviceService.BlackberryPhone()
BlackBerry Tablet BlazorCurrentDeviceService.BlackberryTablet()
Windows BlazorCurrentDeviceService.Windows()
Windows Phone BlazorCurrentDeviceService.WindowsPhone()
Windows Tablet BlazorCurrentDeviceService.WindowsTablet()
Firefox OS BlazorCurrentDeviceService.FireFoxOs()
Firefox OS Phone BlazorCurrentDeviceService.FireFoxOsPhone()
Firefox OS Tablet BlazorCurrentDeviceService.FireFoxOsTablet()
MacOs BlazorCurrentDeviceService.MacOs()
MeeGo BlazorCurrentDeviceService.MeeGo()
NodeWebkit BlazorCurrentDeviceService.NodeWebkit()
Cordova BlazorCurrentDeviceService.Cordova()
Television BlazorCurrentDeviceService.Television()

Orientation Methods

Orientation Method
Landscape BlazorCurrentDeviceService.Landscape()
Portrait BlazorCurrentDeviceService.Portrait()

Useful Methods

Method Returns
BlazorCurrentDeviceService.Type() 'mobile', 'tablet', 'desktop', or 'unknown'
BlazorCurrentDeviceService.Orientation() 'landscape', 'portrait', or 'unknown'
BlazorCurrentDeviceService.OS() 'ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'windows', 'macos', 'fxos', 'meego', 'television', or 'unknown'

TODO

  • Implement onChangeOrientation callback

License

MIT

blazorcurrentdevice's People

Contributors

arivera12 avatar hugovg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.