Chrome DevTools: Identify objects created with a certain constructor
Last updated: 13th June 2018Built into the DevTools Console is the Command Line API. You can use this JavaScript snippet:
queryObjects(Constructor)
To query for and retrieve objects which were created from the constructor you specify.
For example you can try:
queryObjects(WebSocket)
/*
If the above returns an empty array...
...try executing `new WebSocket('wss://url')` beforehand
*/
// Discover all Promise objects
queryObjects(Promise)
// Also works with user-defined constructors
class Person {}
new Person()
queryObjects(Person)