Search code examples
node.jsv8

Nodejs global property interception


Im looking for a way to intercept access to object properties in nodejs. In particular, my goal is not to define a proxy for each object manually, but to enable this interception globally, for each newly created object.

That means, for every single access to a property (whether it exists or not) on every single object, whether it was instantiated by me or not, should go through some interception logic.

Example:

// code that sets up interception

let o = {}
o.xyz // => trigger interception mechanism

Is there a way to achieve this in Node.js?


Solution

  • No, such behavior would not be in compliance with the JavaScript spec.