Search code examples
javascriptnode.jsv8

Is it possible to watch object creation over the V8 debugging protocol?


When creating an object in JavaScript via a user-defined constructor, it's easy enough to "hook" (e.g. do something before or after) the creation of the object at runtime as the constructor is just a function. In fact, multiple Aspect Oriented Programming libraries exist to provide this functionality.

However, when using the object literal notation, the object seems to be automagically created by the runtime. Can the creation of these objects, or any other object in fact, be watched via the debugging protocol of V8?

My motivation here is to be able to trace data flow in an application.


Solution

  • Sorry, no, object literal instantiation cannot be watched.