Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is WeChat Mini Programs's operating mechanism?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge about what WeChat Mini Programs's operating mechanism is. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

I. essence

First of all, Mini Program's logical layer and rendering layer are separate, the logical layer runs in JSCore, and does not have a complete browser object.

So there is no related DOM API and BOM API, and this difference results in some libraries that the front-end developers are very familiar with, such as jQuery, Zepto, and so on, cannot be run in Mini Program.

At the same time, the environment of JSCore is different from that of NodeJS, so some NPM packages cannot be run in Mini Program.

In short, js is single-threaded, Mini Program is dual-threaded, and the logical layer and view layer (rendering layer) are separate and running at the same time.

II. Communication

Because Mini Program is dual-threaded, the data transmission of any logical layer and view layer is the communication between threads, so there is a certain delay, so the update of the page becomes an asynchronous operation.

Asynchronism makes the runtime sequence of each part more complicated. For example, when rendering the first screen, the logic layer and the render layer will initialize at the same time, but the rendering layer needs the data of the logic layer to render the interface.

If the initialization of the render layer is completed quickly, you have to wait for the instructions of the logic layer to proceed to the next step.

So Mini Program's life cycle plays a role, as follows

III. Operating mechanism

There are two situations in which Mini Program starts to run:

1. Cold start (restart): when the user opens it for the first time or Mini Program is reopened after being actively destroyed by Wechat, Mini Program needs to be reloaded and started, that is, cold start.

two。 Hot start: the user has already opened Mini Program, and then reopens the Mini Program within a certain period of time. There is no need to restart at this time, just switch the backstage Mini Program to the foreground, this process is hot start.

These are all the contents of the article "what is WeChat Mini Programs's operating mechanism?" Thank you for your reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report