Raise your ✋ if you’ve built a website/app without any libraries in the last year or so
Slide 3
Developing with libraries is so common, many of us can’t remember what it is like to develop without them
Slide 4
This isn’t a bad thing
Slide 5
What is bad, is many of us have forgotten about the web platform
Slide 6
Web APIs The app-changing magic (and joy) of
Slide 7
Trent Willis
Staff Software Engineer
Slide 8
What is a Web API? A programming interface built in to the browser But, maybe not all browsers Usually come from the Web Hypertext Application Technology Working Group (WHATWG) Standards
Slide 9
Standards help you discover new realms of web development
Slide 10
Web APIs help you discover new realms of web development
Why would you need that? Get things off the main thread (and stay off)
Slide 15
Website
Slide 16
Website
Web Worker
Slide 17
Website
Web Worker
Web Worker 2
Slide 18
Website
Web Worker
Web Worker 2
Slide 19
Website
Web Worker
Message Channel
Web Worker 2
Slide 20
Why would you need that? Get things off the main thread (and stay off) Decouple execution contexts
Slide 21
Website
Slide 22
Website
Sandboxed Iframe
Slide 23
Main Thread
Website
Sandboxed Iframe
Slide 24
Main Thread
Worker Thread
Website
Sandboxed Iframe
Web Worker
Slide 25
Main Thread
Worker Thread
Website
Sandboxed Iframe
Web Worker
Slide 26
Main Thread
Worker Thread
Website
Sandboxed Iframe
Web Worker
Slide 27
Sandybox Secure, non-blocking sandbox for arbitrary (i.e., user created) functions github.com/trentmwillis/sandybox
Slide 28
The real APIs are the things we learned along the way MessagePort
Web Locks
Iframe
Shadow Realms*
Web Worker
Compartments**
Shared Worker
HTML Sanitizer***
Broadcast Channel
Slide 29
The real APIs are the things we learned along the way Transferable Knowledge Multi-Threading Execution Contexts
Slide 30
Web APIs help you learn Transferable programming skills
Slide 31
The FetchEvent.respondWith()
Slide 32
Website
Slide 33
Website
Service Worker
Slide 34
Website
Service Worker
Server
Slide 35
Website
Service Worker
Server
Slide 36
Service Worker
Website
event.respondWith(stuff)
Cache
Server
Slide 37
Why would you need that? Caching network responses Invisible file/data manipulation Polyfilling/creative new file types Mocking non-XHR responses
Slide 38
Service Worker
Website
Server
Slide 39
Blackbox
Service Worker
Website
Server
Slide 40
Blackbox GET image.epng*
Service Worker
Website
.epng
.epng
event.respondWith(stuff) .epng
.png
Transform† *.epng = custom encrypted image format not supported by browsers
†in this case, decrypt .epng to .png
Server
Slide 41
Blackbox GET script.ts
Service Worker
Website
.ts
.ts
event.respondWith(stuff) .ts
.js
Transform† †in this case, compile .ts to .js
Server
Slide 42
TypeScript in the Browser Use <script
src=“index.ts”></script>
typescript-in-browser.glitch.me
Slide 43
Client-Side TypeScript Plugin System Only need to store the TypeScript file No server-side compilation But! breaks “progressive enhancement”
Slide 44
The real APIs are the things we learned along the way “Advanced” Fetch
Web Crypto
Response
(De)Compression*
Streams
Slide 45
The real APIs are the things we learned along the way Network request and response handling Caching
Streams
File Formats
Graceful Degradation
Creative API Usage
Slide 46
Web APIs help you come up with new Creative ideas
Slide 47
The AudioWorkletProcessor
Slide 48
Website
Slide 49
Website AudioContext
Slide 50
Website AudioContext AudioWorkletNode
Slide 51
Website Main Thread
Web Audio Rendering Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Slide 52
Website Main Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Web Audio Rendering Thread
process()
Slide 53
Website Main Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Web Audio Rendering Thread
process()
Audio Source
Slide 54
Website Main Thread
AudioContext AudioWorkletNode
Audio Output (Speakers)
AudioWorkletProcessor
Web Audio Rendering Thread
process()
Audio Source
Slide 55
Why would you need that? Custom signal processing (effects) Off-main thread audio visualization Custom sound/noise generation
Slide 56
Website Main Thread
AudioContext AudioWorkletNode
Audio Output (Speakers)
AudioWorkletProcessor
Web Audio Rendering Thread
process()
Audio Source
Slide 57
Website Main Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Web Audio Rendering Thread
process()
Audio Output (Speakers)
Slide 58
Website Main Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Web Audio Rendering Thread
process()
RNG(-1, 1)
(White Noise)
Audio Output (Speakers)
Slide 59
DeepBreathing.app “Smooth” brown noise generation
Slide 60
Website Main Thread
AudioContext AudioWorkletNode
AudioWorkletProcessor
Web Audio Rendering Thread
process()
RNG(-1, 1)
(White Noise)
Audio Output (Speakers)
Slide 61
AudioContext
AudioWorkletNode
White Noise From AudioWorkletProcessor
Slide 62
AudioContext
AudioWorkletNode
BiquadFilterNode (Lowpass)
White Noise From AudioWorkletProcessor
Slide 63
AudioContext
AudioWorkletNode
BiquadFilterNode (Lowpass)
White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
Slide 64
AudioContext
AudioWorkletNode
BiquadFilterNode (Lowpass)
White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
GainNode (Volume)
Slide 65
AudioContext
White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
GainNode (Volume)
Brown Noise To Speakers
AudioWorkletNode
BiquadFilterNode (Lowpass)
Slide 66
AudioContext
OscillatorNode (LFO) White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
GainNode (Volume)
Brown Noise To Speakers
AudioWorkletNode
BiquadFilterNode (Lowpass)
Slide 67
AudioContext
GainNode (Intensity) OscillatorNode (LFO) White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
GainNode (Volume)
Brown Noise To Speakers
AudioWorkletNode
BiquadFilterNode (Lowpass)
Slide 68
AudioContext
Frequency GainNode (Intensity) OscillatorNode (LFO) White Noise From AudioWorkletProcessor
BiquadFilterNode (Highpass)
GainNode (Volume)
Brown Noise To Speakers
AudioWorkletNode
BiquadFilterNode (Lowpass)
The real APIs are the things we learned along the way Web Audio APIs
Permissions
Web MIDI
Vibration
Media Capture and Streams
Slide 71
The real APIs are the things we learned along the way Audio Concepts
Input Devices
Signal Processing
Streams, Threads, File Formats, etc.
Slide 72
Cool, so what?
Slide 73
Web APIs can unlock new architectures
Slide 74
Web APIs can unlock new creative power
Slide 75
Web APIs can unlock new perspectives
Slide 76
Web APIs can unlock new perspectives Why would I need that? What else is related to this? How does this improve my understanding of the web? What transferrable skills am I learning? When is the next JS trivia night?
Slide 77
Web APIs can restore the joy of web development. What are you going to build?