Calling localFolder.getFileAsync synchronously RRS feed

  • Question

  • I've seen in C# that you can use the await key word to wait for an async action to complete before continuing on with execution. I can't seem to find anyway of performing that same action in javascript.

    Have I missed it in the docs somewhere?

    Friday, April 13, 2012 12:14 PM


  • Unless I'm missing something, await does not block the whole thread but just a portion of the asynchronous method it is used in.

    In WinRT/JavaScript programming, that is accomplished by the .then and .done constructs like this:

    //This code waits for getFileAsync to complete//
    //Do something with myFile here after it is retrieved//
    See Asynchronous Programming in JavaScript.

    Friday, April 13, 2012 2:04 PM