-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 增加 isQuickApp 的env变量 #48
Conversation
…feat-quickapp-env
…feat-quickapp-env
callNative 是快应用判断的唯一条件 |
packages/env/README-zh_CN.md
Outdated
| 微信小程序 | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ | | ||
| 微信小程序 WebView | ✘ | ✔️ | ✘ | ✔️ | ✘ | ✘ | | ||
| 快应用 | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ | | ||
| 快应用 Webview | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V
packages/env/src/index.ts
Outdated
@@ -15,3 +16,4 @@ export const isMiniApp = !isUndef(typeof my) && my !== null && !isUndef(typeof m | |||
// In wechat mini program, wx.login is a function | |||
// In wechat mini propgram webview, there is no wx.login, but exist wx.miniProgram | |||
export const isWeChatMiniProgram = !isUndef(typeof wx) && wx !== null && (!isUndef(typeof wx.login) || !isUndef(typeof wx.miniProgram)); | |||
export const isQuickApp = !isUndef(typeof global) && global !== null && (!isUndef(typeof global.callNative)) && !isWeex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通过 callNative 判断并不带有端上特征,是否加上快应用业务上的特征会更准确,比如 useragent 的 packageName
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
通过 callNative 判断并不带有端上特征,是否加上快应用业务上的特征会更准确,比如 useragent 的 packageName
目前快应用容器内的全局环境只有global,内置属性中只有callNative能拿来区分其他端。例如userAgent类的判断在快应用的web组件内部才能通过window拿到。
No description provided.