Skip to content
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

Merged
merged 15 commits into from
Mar 11, 2020

Conversation

wanglijie
Copy link
Contributor

No description provided.

@SoloJiang SoloJiang changed the base branch from master to releases/env March 11, 2020 02:33
@SoloJiang SoloJiang changed the base branch from releases/env to master March 11, 2020 03:58
@SoloJiang
Copy link
Collaborator

callNative 是快应用判断的唯一条件

| 微信小程序 | ✘ | ✔️ | ✘ | ✘ | ✘ | ✘ |
| 微信小程序 WebView | ✘ | ✔️ | ✘ | ✔️ | ✘ | ✘ |
| 快应用 | ✘ | ✘ | ✔️ | ✘ | ✘ | ✘ |
| 快应用 Webview | ✘ | ✘ | ✘ | ✔️ | ✘ | ✘ |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

通过 callNative 判断并不带有端上特征,是否加上快应用业务上的特征会更准确,比如 useragent 的 packageName

Copy link
Contributor Author

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拿到。

@SoloJiang SoloJiang merged commit c68ff0b into raxjs:master Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants