In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to achieve Mini Program page-level version control, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
Before that, let's take a look at the operating mechanism of Mini Program.
There are two situations when Mini Program starts, one is "cold start" and the other is "hot start".
"hot start"
If the user has already opened a Mini Program, and then reopened 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.
"cold start"
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.
"thoughts on the update of Mini Program version"
When Mini Program starts cold, if a new version is found, the new version of the code package will be downloaded asynchronously and started with the local package on the client at the same time, that is, the new version of Mini Program will not be applied until the next cold start.
In the development of Mini Program, we often encounter a situation where when repairing an emergency bug or launching a new feature, the product expects users to open Mini Program with the latest version.
You may have thought of using wx.getUpdateManager API to listen for version updates when Mini Program starts, and to force Mini Program to restart and use the new version.
However, this will lead to a user experience problem. Users will be prompted to update every time there is a new version of the package. Mini Program, which requires fast iterative updates, is particularly unfriendly and very disturbing to users.
Zhuan is a Mini Program with millions of daily active users, with many lines of business, and new versions may be released every day. There is an urgent need to implement version update management.
We think that we can get the version information that needs to be updated through the API, and then determine whether we need to restart the new package based on the returned results.
In view of the fact that there are multiple business lines to be transferred, it is hoped that users do not have to force updates when they do not enter a business line that needs to be updated. They just want to judge whether they need to be updated with the granularity of the page. The following picture is the idea of our design:
But this involves the need for RD to help us store data and provide an interface to obtain data. At that time, towards the end of the year, RD resources were very tight, so I thought that without using RD, could the front end do it by myself?
As a result, cloud development, official debut.
"capabilities provided by cloud development: database"
Cloud developer provides a JSON database that allows us to create a collection of version information in the console and insert version information that needs to be updated.
"capabilities provided by cloud development: cloud functions"
Cloud functions enable us to write our own functions to read the database. For each request, we only return the first three records, and if the version of the three records is higher than the version that comes with Mini Program, it means that the user has not opened Mini Program for a long time, and directly prompts the user to update.
At the beginning, our design idea was to call the cloud function to determine whether the current page needs to be updated when each page is opened. The number of pages redirected is 10 million times a day. At that time, we were worried about whether cloud development could withstand the pressure.
In this way, do not rely on RD, perfect solution to the problem of version update, of course, the design idea needs to be improved, but cloud development so that we do not have to worry.
On how to achieve Mini Program page-level version control to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.