Loading video player…

Welcome to the Settings Audit

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:

Language: JavaScript
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:

Language: Program Output
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 get trap and Reflect.get(), and keep a getter’s reads on the right receiver
  • Accept or refuse a setting in a set trap that answers with a boolean, and log only successful writes
  • Decide what membership and deletion mean with has and deleteProperty traps, 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.

Download

Course Slides (.pdf)

958.2 KB
Download

Sample Code (.zip)

11.5 KB

00:00 Welcome to JavaScript Metaprogramming for Pythonistas! You’ll learn how your code can intercept property reads and writes, join JavaScript’s protocols, see template parts, and where those hooks stop.

00:13 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.

00:24 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.

00:37 A dashboard reads the level and the label. Both values print, but the audit lists only level. The label read got through, and nobody logged it, in the Python original too.

00:50 How does JavaScript catch every read? The next video shows how.

00:56 You’ll audit every read through a proxy, and check every write. You’ll decide what membership and deletion mean, and see where a proxy must tell the truth.

01:06 You’ll give settings JavaScript protocols, receive template parts, and choose a factory over a metaclass. Then you’ll build the settings audit layer.

01:17 You need to know Python’s __getattr__() and __setattr__(), descriptors, metaclasses and class decorators. In JavaScript, you need objects and property descriptors, getters and setters, symbols, and iteration.

01:32 You need a current version of Node, and no packages. The examples use Node 26 and Python 3.15.

01:42 Short videos mix with text lessons and exercises, and every video has a summary. 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.

Become a Member to join the conversation.