universal-env
Advanced tools
Comparing version 3.2.1 to 3.2.2
{ | ||
"name": "universal-env", | ||
"author": "rax", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"description": "", | ||
@@ -28,3 +28,3 @@ "main": "lib/index.js", | ||
"build-plugin-rax-api-builder": "^0.1.0", | ||
"build-plugin-rax-component": "^0.1.0", | ||
"build-plugin-rax-component": "^0.2.0", | ||
"driver-universal": "^3.0.0", | ||
@@ -31,0 +31,0 @@ "rax": "^1.1.0", |
# universal-env [![npm](https://img.shields.io/npm/v/universal-env.svg)](https://www.npmjs.com/package/universal-env) | ||
Judge runtime environment | ||
判断和获取运行时环境 | ||
## Support | ||
## 支持 | ||
<img alt="browser" src="https://gw.alicdn.com/tfs/TB1uYFobGSs3KVjSZPiXXcsiVXa-200-200.svg" width="25px" height="25px" /> <img alt="weex" src="https://gw.alicdn.com/tfs/TB1jM0ebMaH3KVjSZFjXXcFWpXa-200-200.svg" width="25px" height="25px" /> <img alt="miniApp" src="https://gw.alicdn.com/tfs/TB1bBpmbRCw3KVjSZFuXXcAOpXa-200-200.svg" width="25px" height="25px" /> <img alt="wechatMiniprogram" src="https://img.alicdn.com/tfs/TB1slcYdxv1gK0jSZFFXXb0sXXa-200-200.svg" width="25px" height="25px"> <img alt="bytedanceMicroApp" src="https://gw.alicdn.com/tfs/TB1jFtVzO_1gK0jSZFqXXcpaXXa-200-200.svg" width="25px" height="25px"> <img alt="quickApp" src="https://gw.alicdn.com/tfs/TB1MP7EwQT2gK0jSZPcXXcKkpXa-200-200.svg" width="25px" height="25px"> | ||
## Install | ||
## 安装 | ||
```bash | ||
@@ -13,3 +13,3 @@ $ npm install universal-env --save | ||
## Usage | ||
## 示例 | ||
```javascript | ||
@@ -22,40 +22,41 @@ import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isQuickApp } from 'universal-env'; | ||
### `isWeex: boolean` | ||
Checks if environment is a weex environment. | ||
校验 Weex 环境 | ||
### `isWeb: boolean` | ||
Checks if environment is a web environment. | ||
校验 Web 环境 | ||
### `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. | ||
校验 Node.js 环境 | ||
## Results in each container | ||
## 各容器内返回结果 | ||
Note:To judge MiniProgram env in WebView, please insert JS SDK accordingly. | ||
注:以下各小程序 WebView 内容器判断依赖 WebView 中注入容器的JS SDK。 | ||
| | 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 | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | | ||
| | isMiniApp | isWeChatMiniProgram | isByteDanceMicroApp | isQuickApp | isWeb | isWeex | isNode | | ||
| ------------------- | --------- | ------------------- | ------------------ | ---------- | ----- | ------ | ------ | | ||
| 阿里小程序 | ✔️ | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | | ||
| 阿里小程序 WebView | ✔️ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | | ||
| 微信小程序 | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ | ✘ | | ||
| 微信小程序 WebView | ✘ | ✔️ | ✘ | ✘ | ✔️ | ✘ | ✘ | | ||
| 字节跳动小程序 | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ | | ||
| 字节跳动小程序 WebView | ✘ | ✘ | ✔️ | ✘ | ✔️ | ✘ | ✘ | | ||
| 快应用 | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ | | ||
| 快应用 WebView | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | | ||
| Weex | ✘ | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | | ||
| Node | ✘ | ✘ | ✘ | ✘ | ✘ | ✘ | ✔️ | | ||
| Web | ✘ | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | | ||
13822
11
61