-
Notifications
You must be signed in to change notification settings - Fork 0
API Proxy
Liu.Yandong.Hanks edited this page Aug 21, 2026
·
3 revisions
Dynamic interception of object property reads and writes.
Proxy wraps a target object and routes property reads and writes through handler functions supplied by the caller. Use it for computed views, access logging, or validation layers over an existing object.
Caution
Handlers must be explicit and free of recursive side effects. Reading or writing the same proxy unconditionally from inside a handler causes unbounded re-entry.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
target |
object |
Yes | Object to wrap. |
options |
object |
Yes | Handler object that must provide both get(obj, key) and set(obj, key, value). |
Returns
Proxy — the proxy object.
Behavior
Both handlers are required. An options object that omits get or set is an invalid construction.
Example
var source = { count: 1 };
var proxy = new Proxy(source, {
get: (obj, key) => obj[key],
set: (obj, key, value) => { obj[key] = value; return value; }
});
proxy.count = 2;
return proxy.count; // 2AuroraScript.JIT 4.0.0 · Documentation Home · Repository · MIT License