This is a cross-platform open source library for obtaining device name and device model.
npm install various-devices
<script src='https://unpkg.com/various-devices/dist/various-devices.iife.js'></script>
It will be exposed to global as variousDevices
Get the current environment
cjs
const { getEnv } = require('various-devices');
esm
import { getEnv } from 'various-devices';
Return value
params | introduce |
---|---|
electron | 桌面程序 |
browser | 浏览器 |
node | node环境 |
webworker | webworker |
For more APIs, please refer to the