execAsyncAtPriority method

[Some information relates to pre-released product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.]

Schedules a callback to be executed at a later time according to the given priority.

Internet Explorer 10

 

Syntax

MSApp.execAsyncAtPriority(asynchronousCallback, priority, args);

Parameters

  • asynchronousCallback [in]
    Type: function

    The callback function to run asynchronously, dispatched at the given priority priority.

  • priority [in]
    Type: DOMString

    The contextual priority value at which the asynchronousCallback callback is run. See MSApp Constants.

  • args [in]
    Type: any

    An optional series of arguments that are passed to the synchronousCallback callback function (as parameters 1 and on).

Return value

This method does not return a value.

Remarks

The provided asynchronousCallback callback function is executed asynchronously later. asynchronousCallback will be dispatched according to the provided priority. Normal priority is equivalent to the existing setImmediate method. When the callback is run, the current contextual priority is set to the provided priority parameter value for the duration of the callback's execution.

The asynchronousCallback callback parameter can be any function. If arguments are provided after the priority parameter, they will all be passed to the callback function.

Note  Unlike execAtPriority, any object returned by the asynchronousCallback callback function is ignored (and not returned via execAsyncAtPriority).

 

Examples

MSApp.execAsyncAtPriority(function () { // This callback dispatches at the idle level.
  user.getFirstNameAsync().then(function () { // Promise completes at idle level.
    return user.getLastNameAsync();
  }).done(function () { // Promise completes at idle level.
    // USEFUL CODE HERE
  });
}, MSApp.IDLE);

See also

MSApp

execAtPriority

MSApp Constants