v7.3.0

AsyncHelper

A helper class to make asynchronous tasks await friendly.

No results

Functions

Functions are methods available for calling on the class
  • animationFrame( )
    ASYNC
    static

    Returns a promise that resolves on next animation frame.

     async method() {
         // do work
         await AsyncHelper.animationFrame();
         // do more work
     }
    
  • yield( )
    ASYNC
    static

    Returns a promise that resolves as soon as possible, allowing the browser to minimally process other messages. This is the shortest possible delay the browser offers, so be aware that it does not necessarily allow the browser to paint or reflow if used in a long loop. It does, however, allow other async methods to execute.

     async method() {
         await AsyncHelper.yield();
         // ...
     }
    

Source path

Core/helper/AsyncHelper.js

Contents