Reflections - mmedrano9438/peripheral-brain GitHub Wiki
The Reflect API is used to invoke the corresponding internal method. For example, the code below creates a proxy p with a [deleteProperty] trap that intercepts the Delete internal method. Reflect.deleteProperty() is used to invoke the default Delete behavior on targetObject directly. You can replace it with [delete], but using Reflect saves you from having to remember the syntax that each internal method corresponds to.
`const p = new Proxy( {}, { deleteProperty(targetObject, property) { // Custom functionality: log the deletion console.log("Deleting property:", property);
// Execute the default introspection behavior
return Reflect.deleteProperty(targetObject, property);
},
}, ); `