@nothing-but/platform
v0.1.0
Published
A set of const boolean variables identifying device and browser type.
Downloads
2
Readme
@nothing-but/platform
A set of const boolean variables identifying device and browser type.
Installation
npm install @nothing-but/platform
# or
pnpm add @nothing-but/platform
# or
yarn add @nothing-but/platform
How to use it
import {is_webkit, is_firefox} from '@nothing-but/platform'
if (!is_firefox) {
// won't run on the Mozilla Firefox Browser
}
if (is_webkit) {
// run WebKit Engine specific code
}
Note: This package is tree-shakable, all unused variables will be removed from the bundle.
Note: On the server, all variables will be
false
.
List of variables
Devices
is_android
— Is Android Deviceis_windows
— Is Windows Deviceis_mac
— Is Mac Deviceis_iphone
— Is IPhone Deviceis_ipad
— Is IPad Deviceis_ipod
— Is IPod Deviceis_ios
— Is IOS Deviceis_apple_device
— Is Apple Deviceis_mobile
— is a Mobile Browser
Browsers
is_firefox
— Browser is Mozilla Firefoxis_opera
— Browser is Operais_safari
— Browser is Safariis_ie
— Browser is Internet Exploreris_chromium
— is Chromium-based browseris_edge
— Browser is Edgeis_chrome
— Browser is Chromeis_brave
— Browser is Brave
Rendering Engines
is_gecko
— Browser using Gecko Rendering Engineis_blink
— Browser using Blink Rendering Engineis_webkit
— Browser using WebKit Rendering Engineis_presto
— Browser using Presto Rendering Engineis_trident
— Browser using Trident Rendering Engineis_edge_html
— Browser using EdgeHTML Rendering Engine
Changelog
See CHANGELOG.md