You’ll learn how your code can intercept property reads and writes, join JavaScript’s protocols, see template parts, and where those hooks stop. Your project ports a small settings library from Python: a dashboard reads its level and label, and an audit should log every read.
Here’s a first taste. The settings are flat: a level of 2 and a label, "desk". In Python, a property
logs each level read. The JavaScript port does the same with a getter:
const audit = [];
const settings = {
_level: 2,
label: "desk",
get level() {
audit.push("level");
return this._level;
},
};
console.log(settings.level, settings.label);
console.log(audit);
A dashboard reads the level and the label. Both values print, but the audit lists only level:
2 desk
[ 'level' ]
The label read got through, and nobody logged it, in the Python original too. How does JavaScript catch
every read? The next video shows how.
By the end of this course, you’ll be able to:
- Audit every property read through a proxy with its
gettrap andReflect.get(), and keep a getter’s reads on the right receiver - Accept or refuse a setting in a
settrap that answers with a boolean, and log only successful writes - Decide what membership and deletion mean with
hasanddeletePropertytraps, and see why a proxy can’t lie about a frozen setting - Give settings JavaScript protocols with well-known symbols, and receive a template’s parts and values in a tag before they’re combined
- Choose a factory instead of a metaclass, and build the settings audit layer from these parts
You need to know Python’s attribute hooks, such as __getattr__() and __setattr__(), plus descriptors,
metaclasses and class decorators. In JavaScript, you need objects and their property descriptors, getters
and setters, symbols, and iteration.
You’ll need a current version of Node installed, and no packages. The examples use Node 26 and Python 3.15.
The course mixes short videos with text lessons and exercises. Every video has a summary below it. A project video builds the settings audit layer, and a quiz and a summary close the course.
Next up: Intercepting Every Property Read, where a proxy in front of the settings logs every read through it.