universal-env
Judge runtime environment
Support
Install
$ npm install universal-env --save
Usage
import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp } from 'universal-env';
APIS
isWeex: boolean
Checks if environment is a weex environment.
isWeb: boolean
Checks if environment is a web environment.
isMiniApp: boolean
Checks if environment is an alibaba miniprogram environment.
isWeChatMiniProgram: boolean
Checks if environment is a wechat miniprogram environment.
isByteDanceMicroApp: boolean
Checks if environment is a bytedance microapp environment.
isQuickApp: boolean
Checks if environment is a quickapp environment.
isNode: boolean
Checks if environment is a Node.js environment.
Results in each container
Note:To judge MiniProgram env in WebView, please insert JS SDK accordingly.
| isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode |
---|
Alibaba MiniApp | ✔️ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ |
Alibaba MiniApp WebView | ✔️ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ |
Wechat MiniProgram | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ | ✘ |
Wechat MiniProgram WebView | ✘ | ✔️ | ✘ | ✘ | ✔️ | ✘ | ✘ |
ByteDance MicroApp | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ |
ByteDance MicroApp WebView | ✘ | ✘ | ✔️ | ✘ | ✔️ | ✘ | ✘ |
QuickApp | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ |
QuickApp WebView | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ |
Weex | ✘ | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ |
Node | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✔️ |
Web | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ |