Software / Browser

Web platform APIs

These are the named doors out of the page. Each one has a cost, a permission, and a lifetime.

@[web_platform]
network observers workers storage modules

Web Platform APIs

~[fetch]

Fetch API + Streams

Promise-based network I/O. Response.body is a ReadableStream enabling progressive processing. AbortController cancels in-flight requests. Request/Response are structured-cloneable and composable in Service Workers.

  • AbortController
  • ReadableStream
  • TransformStream
  • WritableStream
  • Response.body
?[observe]

Observer APIs

Four observer types: IntersectionObserver (viewport crossing), MutationObserver (DOM changes — microtask delivery), ResizeObserver (element size changes — before paint), PerformanceObserver (metric entries). All avoid polling.

  • IntersectionObserver
  • MutationObserver
  • ResizeObserver
  • PerformanceObserver
*[worker]

Web Workers

True OS-thread parallelism; workers cannot access the DOM. Communication via postMessage (structured clone) or Transferable (zero-copy). SharedWorker shared across browsing contexts. SharedArrayBuffer + Atomics enable wait-free shared memory.

  • postMessage
  • Transferable
  • SharedArrayBuffer
  • Atomics
  • SharedWorker
![sw]

Service Workers

Network proxy off the main thread. Lifecycle: installactivatefetch interception. skipWaiting() + clients.claim() for immediate takeover. Cache API stores Request/Response pairs. Enables offline-first and background sync.

  • Cache API
  • Background Sync
  • Push API
  • skipWaiting
  • clients.claim
$[storage]

Storage APIs

localStorage / sessionStorage: synchronous, string-only, ~5 MB. IndexedDB: async, structured data, large capacity, transactions, indices, available in workers. StorageManager.estimate() queries available quota. Cache API keyed on Request objects.

  • IndexedDB
  • localStorage
  • StorageManager
  • Cache API
  • Cookie Store API
~[ws]

WebSocket + SSE

WebSocket: full-duplex binary-capable TCP channel. EventSource: server-push over HTTP, text-only, auto-reconnect, simpler auth model. Use SSE when only server→client streaming is needed; WS for bidirectional. WebTransport over QUIC is the emerging successor.

  • WebSocket
  • EventSource
  • WebTransport
  • binary frames
%[perf]

Performance APIs

Core Web Vitals: LCP (Largest Contentful Paint), INP (Interaction to Next Paint, replaces FID), CLS (Cumulative Layout Shift). performance.mark / measure for custom spans. PerformanceObserver streams entries asynchronously.

  • LCP
  • INP
  • CLS
  • TTFB
  • Long Tasks
  • User Timing
#[esm]

ES Modules + Import

type="module" scripts defer by default, run in strict mode, and have lexical scope. import() dynamic import returns a Promise. import.meta.url is the module's own URL. importmap remaps bare specifiers to URLs at HTML level. Module map prevents double-evaluation.

  • import.meta
  • dynamic import()
  • importmap
  • modulepreload