Building a Time Machine with ES6 Proxies
summary
Live-coded a working time engine built on ES6 Proxies that logs state changes into an array of snapshots, overrides proxy get/set handlers to push deep-copied states (using structuredClone), and adds an onUpdate callback for free reactivity. It implements stepwise undo/redo, timestamped jumps (cutting history to a chosen time), and branching timelines stored as arrays of timelines; covers pitfalls: reference mutation, memory cost, and the option to save deltas instead of full snapshots.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 1:07About the speaker
- 3:34What are JavaScript proxies
- 5:22Time machine concept
- 9:15Planning the time machine
- 11:06Live coding setup
- 12:13Creating a basic proxy
- 16:32Refactoring into time machine
- 17:36Adding reactivity
- 21:38Implementing undo/redo
- 28:17Demoing the game
- 30:05Integrating time machine
- 33:23Fixing state duplication
- 37:03Deep cloning states
- 39:31Jumping back in time
- 44:12Multi-timeline demo
- 45:18Final implementation
- 46:44Optimization ideas
- 47:11Q&A
related talks
29mBuilding a Time Machine with ES6 Proxies
29mBuilding a Time Machine with ES6 Proxies
24mJavaScript metaprogramming with ES2015 Proxy
26mJavaScript Metaprogramming - ES6 Proxy Use and Abuse
52mJavaScript Metaprogramming - ES6 Proxy Use and Abuse
31mImmer, Immutability and the Wonderful World of Proxies
27mUnlock the Proxy Power (Vue.js)
54mMetaProgramming with JavaScript
