WeChat small program operating environment
May 17, 2021
WeChat Mini Program Development Document
The operating environment of the small program
WeChat applets run on a variety of platforms: iOS (iPhone/iPad) WeChat clients, Android WeChat clients, PC WeChat clients, Mac WeChat clients, and WeChat developer tools for debugging.
The script execution environment and the environment used to render non-native components vary from platform to platform:
-
On iOS, javascript code for the small program logic layer runs in JavaScriptCore, and the view layer is rendered by WKWebView in environments such as iOS 12, iOS 13, and so on;
-
On Android, the javascript code for the small program logic layer runs in V8, and the view layer is rendered by the self-researched XWeb engine based on the Mobile Chrome kernel;
-
On development tools, the javascript code for the small program logic layer is run in the NW .js, and the view layer is rendered by Chromium Webview.
Platform differences
Although the operating environments are very similar, there are some differences:
-
JavaScript syntax and API support are inconsistent: syntax developers
can circumvent (details) by turning on the ES6-to-ES5 feature, and the small program base library has the necessary Polyfill built in to compensate for API
differences (details).
-
WXSS rendering performance is inconsistent: Although most problems can be circumvented by turning on style complements, developers are advised to check the true performance of small programs on iOS and Android separately.
Developer tools are for debugging purposes only, and the final performance is client-based.