js-dojo

5 proxy reflect

What this module drills

Proxy lets you intercept the fundamental operations on an object — reads, writes, calls, enumeration — and Reflect gives you the matching "do the default thing" for each trap. Together they turn "wrap this object and watch it" from a hack into a pattern.

Why it bites

Two ways. First, a trap that forwards with target[key] instead of Reflect.get(target, key, receiver) lets getters sneak past your proxy — koan 01 shows exactly how. Second, proxies are not transparent: objects with internal slots (Map, Date, private fields) break the moment you wrap them, and a WeakMap keyed by identity sees the proxy and the target as two different things. Koans 06 and 07 are those two failures, on purpose.

Order

01 to 04 build the toolkit (audit, spy, guard, time). 05 is revocable access for a plugin. Save 06 and 07 for last — they are the ones that will save you a day of debugging some time next year.