No Login Data Private Local Save

JavaScript Proxy Playground - Online Observe Object

11
0
0
0

⚡ JavaScript Proxy Playground

Observe, intercept, and customize object operations in real time.

Quick examples:
Use console.log() to output to the log panel. The handler traps will be automatically recorded.
Live Interception Log 0 traps
Run your code to see Proxy traps and console outputs here.

📘 Frequently Asked Questions

A Proxy object wraps another object and intercepts operations like property access, assignment, enumeration, and deletion. It lets you define custom behavior for fundamental operations (traps).

All standard traps are automatically captured when you use the built-in createObservable() helper. The playground highlights get, set, deleteProperty, has, ownKeys, and more. You can also define custom traps in the code editor.

Simply wrap your object with createObservable(target). It returns a proxy that logs every trap to the right panel. You can then perform operations like proxy.x = 10 and see the log update.

Absolutely. A set trap can validate values before they are assigned. For instance, you can throw an error or reject the update if the new value doesn't match a type or range. Check the "Validation" preset.

The playground runs your code in a sandboxed function scope. It overrides console.log to capture output, and provides a few safe helper functions. Still, avoid pasting untrusted code. The tool is meant for learning and experimenting.

Proxy.revocable() creates a proxy that can be disabled later. Once revoked, any operation on the proxy throws a TypeError. This is useful for secure resource isolation.