Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@uni/env

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uni/env

[![npm](https://img.shields.io/npm/v/@uni/env.svg)](https://www.npmjs.com/package/@uni/env)

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
185
decreased by-83.47%
Maintainers
2
Weekly downloads
 
Created
Source

env

npm

判断和获取运行时环境

支持

browser weex miniApp wechatMiniprogram bytedanceMicroApp baiduSmartProgram kuaiShouMiniProgram

安装

$ npm install @uni/env --save

示例

import { isWeex, isWeb, isMiniApp, isNode, isWeChatMiniProgram, isByteDanceMicroApp, isBaiduSmartProgram, isKuaiShouMiniProgram } from '@uni/env';

你也可以从大包引入:

import { env } from '@uni/apis';

APIS

isWeex: boolean

校验 Weex 环境

isWeb: boolean

校验 Web 环境

isMiniApp: boolean

校验阿里小程序环境

isWeChatMiniProgram: boolean

校验微信小程序环境

isByteDanceMicroApp: boolean

校验字节跳动小程序环境

isBaiduSmartProgram: boolean

校验百度小程序环境

isKuaiShouMiniProgram: boolean

校验快手小程序环境

isNode: boolean

校验 Node.js 环境

各容器内返回结果

注:以下各小程序 WebView 内容器判断依赖 WebView 中注入容器的JS SDK。

isMiniAppisWeChatMiniProgramisByteDanceMicroAppisBaiduSmartProgramisKuaiShouMiniProgramisWebisWeexisNode
阿里小程序✔️
阿里小程序 WebView✔️✔️
微信小程序✔️
微信小程序 WebView✔️✔️
字节跳动小程序✔️
字节跳动小程序 WebView✔️✔️
百度小程序✔️
百度小程序 WebView✔️✔️
快手小程序✔️
快手小程序 WebView✔️✔️
Node✔️
Web✔️

FAQs

Package last updated on 07 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc