zhi-device
v2.11.0
Published
auto check environment whether in browser, browser extension, electron, node and more
Downloads
217
Maintainers
Readme
zhi-device
auto check environment whether in browser, browser extension, electron, node and more
Usage
import { DeviceDetection, BrowserUtil, DeviceTypeEnum } from "zhi-device"
console.log("isInBrowser=>", BrowserUtil.isInBrowser)
const deviceType: DeviceTypeEnum = DeviceDetection.getDevice()
console.log("deviceType=>", deviceType)
// supported platforms
// Mobile
// Siyuan_Widget
// Siyuan_NewWindow
// Siyuan_MainWindow
// Chrome_Extension
// Chrome_Browser
// Node
Deps
## Congregations! zhi-device need no deps, it is just pure js code 🎉
Dev
pnpm dev -F zhi-device
Build
pnpm build -F zhi-device
Api
pnpm doc -F zhi-device
pnpm md -F zhi-device
Test
Execute the unit tests via vitest
pnpm test -F zhi-device
Publish
pnpm publish -F zhi-device --tag=latest