tezvyn:

TypeScript & Web APIs

TypeScript, browser APIs, WebAssembly, PWAs

124 bites

TypeScript & Web APIs30 sec read

Mozilla WAICT Verifies Web App JavaScript in Nightly

WAICT in Firefox Nightly binds client code to public manifests so browsers reject unlogged JavaScript. This stops compromised servers from silently injecting malicious code into encrypted web apps like Signal. Test it at waict.dev.

TypeScript & Web APIs30 sec read

Claude Mythos Cracks Firefox Bugs Fuzzing Missed

Claude Mythos Preview found 20-year-old XSLT and JIT bugs in Firefox that survived years of fuzzing. Mozilla shows AI now catches sandbox escapes and memory corruption. Add LLM security scanning to hardening workflows before attackers adopt them.

TypeScript & Web APIs30 sec read

Firefox 151 Ships Web Serial API for Hardware

Firefox 151 ships Web Serial API support, letting web apps talk directly to microcontrollers, 3D printers, and USB power meters without native installers. You can flash firmware and read sensors straight from the browser, so test your hardware workflows in…

TypeScript & Web APIs30 sec read

Optimize a canvas with thousands of moving objects

Tests GPU-bound vs CPU-bound bottleneck diagnosis. Strong answers: batch draw calls to cut JS-to-GPU overhead, and render to a smaller back buffer to reduce fill-rate cost.

TypeScript & Web APIs30 sec read

Explain the difference between microtask and macrotask queues

WHAT IT TESTS: Your event loop mental model and starvation hazards. ANSWER OUTLINE: Macrotasks like setTimeout run one per tick; microtasks like Promises drain fully after each task before rendering.

TypeScript & Web APIs30 sec read

How would you structure TypeScript code and exports for effective tree-shaking?

Tests ES module semantics and sideEffects for library authors. Great answers: emit ESM, set sideEffects:false, avoid stateful barrel files, and preserve import syntax. Red flag: saying ESM alone guarantees tree-shaking without mentioning side effects.

TypeScript & Web APIs30 sec read

How do modern build tools handle TypeScript vs tsc?

WHAT IT TESTS: separating transpilation from type checking for speed. Great answer: fast native tooling strips TS per-file on demand via native ESM; browser loads only visited modules; tsc/ts-loader check/bundle the whole graph upfront.

TypeScript & Web APIs30 sec read

In WebGL, what is the difference between attributes and uniforms?

Tests per-vertex versus per-draw-call data flow. Attributes vary per vertex from buffers; uniforms are constant per draw call. Cite vertex positions as attributes and an MVP matrix as uniform.

TypeScript & Web APIs30 sec read

Use MediaRecorder to capture a canvas stream and download as WebM

Tests MediaRecorder lifecycle and blob assembly. Answer: canvas.captureStream() into new MediaRecorder with video/webm, start(), collect chunks via dataavailable, stop(), then build a Blob and object URL for download.

TypeScript & Web APIs30 sec read

Explain the roles of vertex and fragment shaders in WebGL

WHAT IT TESTS: GPU pipeline separation between geometry transform and pixel color. ANSWER OUTLINE: vertex shaders write gl_Position per vertex; fragment shaders write gl_FragColor per pixel. RED FLAG: swapping their outputs or claiming CPU/DOM access.

TypeScript & Web APIs30 sec read

How do you create a smooth Canvas 2D loop with requestAnimationFrame?

Tests render pipeline timing. Outline: queue rAF per refresh; derive delta from timestamp for frame-rate independence; recurse each frame; cancel via cancelAnimationFrame. Red flag: claiming rAF locks 60fps, ignoring timestamp, or setInterval is fine.

TypeScript & Web APIs30 sec read

Write a TypeScript async/await function that requests webcam access and handles errors

This tests async/await error handling for getUserMedia and stream attachment. A good answer uses try/catch, sets video.srcObject, and branches on NotAllowedError and NotFoundError. A red flag is omitting catch or using src instead of srcObject.

TypeScript & Web APIs30 sec read

Get canvas 2D context and draw a filled circle

This tests Canvas API coordinates and context acquisition. A strong answer selects the canvas, calls getContext("2d"), uses path functions for circles, sets color style, and fills. A red flag is ignoring the top-left origin or using SVG instead.

TypeScript & Web APIs30 sec read

How do you programmatically play, pause, and dynamically set a video source?

Your grasp of HTMLMediaElement's imperative API and the play() Promise. Query the video, attach play() and pause() to buttons, and set src or swap source children then call load(). Treating play() as synchronous or changing src without load().

TypeScript & Web APIs30 sec read

Design a Service Worker caching strategy for a news app

TESTS: Matching resources to caching patterns and justifying speed vs freshness. OUTLINE: Cache First for the app shell, Stale-While-Revalidate for static assets, and Network First for article APIs. RED FLAG: One strategy everywhere or ignoring cache quotas.

TypeScript & Web APIs30 sec read

Explain Network First vs Cache First caching and when to use each

Tests matching caching strategy to asset freshness. Cache First serves static assets from the Cache API, falling back to network. Network First fetches fresh content, falling back to cache offline.

TypeScript & Web APIs30 sec read

Describe the Service Worker lifecycle and cache versioning

Tests your grasp of the Service Worker lifecycle and cache versioning. A strong answer sequences register, install, activate, and fetch; notes install precaches assets while activate purges old caches and finalizes takeover.

TypeScript & Web APIs30 sec read

Pass data to a Web Worker and transfer an ArrayBuffer efficiently

Tests postMessage clone versus transferable objects for zero-copy transfer. Good answers note postMessage copies by default, but ArrayBuffer can move via transfer list, neutering the original.

TypeScript & Web APIs30 sec read

SPA back button: what event fires and how do you handle it?

Tests History API literacy. Strong answer: popstate event, PopStateEvent type, restore UI via event.state, and zero-delay setTimeout for DOM sync. Red flag: confusing popstate with pushState or using hashchange for modern History API routing.

TypeScript & Web APIs30 sec read

What is a Service Worker's role and key PWA capability?

Tests understanding of the Service Worker as a network proxy and its core PWA benefit. A strong answer states it intercepts requests as a proxy and enables offline use via granular caching. Red flag: confusing it with Web Workers or DOM manipulation.

TypeScript & Web APIs · Tezvyn