SUMMARY
HTML5, in addition to defining new markup rules, also defines several JavaScript APIs. These APIs are designed to enable better web interfaces that can rival the capabilities of desktop applications. The APIs covered in this chapter are as follows:
- The Atomics API allows you to protect your code from race conditions resulting from multithreaded memory access patterns.
- The
postMessage()
API provides the ability to send messages across documents from different origins while keeping the security of the same-origin policy intact. - The Encoding API enables you to seamlessly convert between strings and buffers—an increasingly common pattern.
- The File API affords you robust tools for sending, receiving, and reading large binary objects.
- The media elements
<audio>
and<video>
have their own APIs for interacting with the audio and video. Not all media formats are supported by all browsers, so make use of thecanPlayType()
method to properly detect browser support. - The...