Async 设置为true,然后您可以使用PageAsyncTask通过该页面注册异步工作(或者,您可以使用asyncvoid事件处理程序)。Async to true, then you can use PageAsyncTask to register async work with that page(alternatively, you can use async void event handlers).此外,Chakra还支持大部分ECMAScript2015(即ES6)特性,并支持部分ECMAScript提案特性,如Async Functions和SIMD。 Additionally, Chakra supports most of the ECMAScript 2015(aka ES6) features and has support for some of the future ECMAScript proposals like Async Functions and SIMD. 在加载MapsJavaScriptAPI的script标记中,可以省略async 属性和callback参数。 In the script tag that loads the Maps JavaScript API, it is possible to omit the async attribute and the callback parameter. 例如,这是一个通用的映射函数Map,它把它的func参数上的async 或是throws效果进行传播:. For instance, here is a universal mapping function, Map, that propagates the async or throws effect of its func parameter. 如果浏览器无法识别async 函数,则会被认为是旧版本的浏览器,此时就会用到polyfill包。 If the browser isn't able to evaluate an async function, we assume that it's an old browser and just ship the polyfilled bundle.
既然您已经看到了Async /Await的好处,那么让我们讨论一些重要的细节,这些细节很重要。 Now that you have seen the benefit of Async /Await, let's discuss some smaller details that are important to know. 事实上,很多在async 的集合类模块可以很容易用一个列表的promises来替代。 In fact, many things in the async collection module can be easily replaced with operations on lists of promises. Async function声明定义了一个异步函数,它返回一个AsyncFunction对象。The async function declaration defines an asynchronous function, which returns an AsyncFunction object.在引导下,async /await实际上转化为Promise,然后回调。 Under the hood , await/await actually translate to promises and then callbacks. Async TargetingPack的一个升级版本为Silverlight4和WindowsPhone7.5提供了异步的特性。An updated version of the Async Targeting Pack now provides asynchronous features to Silverlight 4 and Windows Phone 7.5. Async 仅适用于外部脚本(只有在使用src属性时).The async attribute is only for external scripts(and should only be used if the src attribute is present).PEP-0492通过使用async 关键字显式的对生成器和协程做了区分。 PEP-0492 makes an explicit distinction between generators and co-routines through the use of the the async keyword. Node.js7.6正式默认支持async /await功能,并能够使低内存设备获得更出色的性能。 Node. js 7.6 has shipped with official support for async /await enabled by default and better performance on low-memory devices. Async 函数的最底层使用Promises--那就是为何async函数将回到一个Promise。Under the hood async functions using Promises- this is why the async function will return with a Promise. 支持最新的TypeScript2.1版本,其中包括对async /await的全方位支持,以及更流线型的工具链。 Support for latest TypeScript update to version 2.1, which includes global support for async /await, and a more streamlined toolchain. Async 属性允许浏览器在MapsJavaScriptAPI加载的同时渲染网站的其余内容。The async attribute lets the browser render the rest of your website while the Maps JavaScript API loads.如果我们把Async 作为例子,你可以注意到AsyncTask需要被显式执行。 If we look at Async as an example, you can notice that AsyncTask need to be executed explicitly. 最后,我们调用了async 函数,这个函数只是简单的生成了一个封装调用其他promise的promise。 Finally, we invoke the async function which simply spawns a promise which encapsulates the logic of invoking the other promises. Async /await函数的目的是简化同步使用promise的行为,并对一组promises执行一些处理。The purpose of async /await functions is to simplify the behavior of using promises synchronously and to perform some behavior on a group of Promises. Async 函数的底部使用Promises--这就是干什么async 函数将回来一个Promise。Under the hood async functions using Promises- this is why the async function will return with a Promise.
展示更多例子
结果: 230 ,
时间: 0.0389
English
Bahasa indonesia
日本語
عربى
Български
বাংলা
Český
Dansk
Deutsch
Ελληνικά
Español
Suomi
Français
עִברִית
हिंदी
Hrvatski
Magyar
Italiano
Қазақ
한국어
മലയാളം
मराठी
Bahasa malay
Nederlands
Norsk
Polski
Português
Română
Русский
Slovenský
Slovenski
Српски
Svenska
தமிழ்
తెలుగు
ไทย
Tagalog
Turkce
Українська
اردو
Tiếng việt