Files
Maor LegerandGitHub c91350217a Add sample for using storage-blob in web workers (#14809)
## What

- Adds a helpful error message about missing global DOM APIs when using core-xml / core-http in web workers 
- Adds a sample and document demonstrating possible workarounds and polyfills

## Why

A customer raised an issue in #11067 when trying to use @azure/storage-blob from a web worker. Because we use DOM APIs which are not available for web workers, customers using Storage Blob (and any other library that depends on XML) in workers will see a few errors:

1. `document` is not defined
2. `window` is not defined (fixed in #13873)

We decided in a previous PR (see https://github.com/Azure/azure-sdk-for-js/pull/13977#issuecomment-786273058) on some guidelines for supporting platforms other than browsers and node out of the box. And bundling a heavy XML library such as `xml2js` to support web workers did not meet the criteria of support we want to provide. 

What this change offers is a better error message when we detect global dependencies are missing and a sample demonstrating how I might use an XML / DOM library to provide this functionality in web workers.

Resolves #11067
2021-04-21 10:27:42 -07:00

14 lines
459 B
HTML

<!DOCTYPE html>
<html>
<head> </head>
<body>
<h1>Web Worker samples</h1>
<h3>Open the developer tools window to see messages from the web workers!</h3>
<!--
We're using Parcel which will replace this with the proper bundled js file for us.
If you're interested in learning more about Parcel's TypeScript support please refer to https://parceljs.org/typeScript.html.
-->
<script src="./index.ts"></script>
</body>
</html>