Skip to content

Instantly share code, notes, and snippets.

@mattpodwysocki
Last active August 15, 2016 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattpodwysocki/7b613ca36ef22d2cc4241b19c5c2ed04 to your computer and use it in GitHub Desktop.
Save mattpodwysocki/7b613ca36ef22d2cc4241b19c5c2ed04 to your computer and use it in GitHub Desktop.
IAsyncOperation<String^>^ ChakraJavaScriptExecutor::RunScriptFromFile(String^ sourceUri)
{
Uri^ fileUri = ref new Uri(sourceUri);
return create_async([this, fileUri, sourceUri]
{
return create_task(StorageFile::GetFileFromApplicationUriAsync(fileUri))
.then([this, sourceUri](StorageFile^ storageFile)
{
return create_task(FileIO::ReadTextAsync(storageFile));
})
.then([this, sourceUri](String^ str)
{
return create_async([this, sourceUri, str] { return this->RunScript(str, sourceUri); });
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment