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

How does WeChat Mini Programs support the Promise feature in ES6

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

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces WeChat Mini Programs how to achieve support for ES6 Promise features of the relevant knowledge, the content is detailed and easy to understand, simple and fast operation, with a certain reference value, I believe that after reading this WeChat Mini Programs how to achieve support for ES6 in Promise features of the article will have a harvest, let's take a look.

Problems encountered

After the updated version of Wechat developer tools, the native support for Promise features in ES6 has been removed. The reason is that since physical machines do not support Promise, we need to introduce third-party Promise libraries.

Wechat update log

Solution

Download third-party libraries

What I introduce here is the Bluebird library, which can be downloaded from the Bluebird official website or locally.

Bluebrid provides two complete Promise library files that have been built, the uncompressed bluebird.js file and the compressed bluebird.min.js file. When you click on these two files, you find that they are not downloaded, but only show the source code. At this time, you can select and copy them all, and then create a new js file in WeChat Mini Programs's project and paste it into it.

Introduce a third-party library

Above, I created a new promise.js file in the utils folder under WeChat Mini Programs's project directory, and then used the ES6 syntax import Promise from'. / promise.js' in the http.js directory to complete the introduction of bluebird, so that it can be used directly through new Promise (). The experience is the same as the native ES6.

This is the end of the article on "how WeChat Mini Programs supports Promise features in ES6". Thank you for reading! I believe that everyone has a certain understanding of "how WeChat Mini Programs supports Promise features in ES6". If you want to learn more, you are welcome to follow 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