Wednesday, June 13, 2018

Dev Tips: DevTools: ๐Ÿ”Ž Identify objects created with a certain JavaScript constructor

Dev Tips

 

DevTools: Identify objects created with a certain JavaScript constructor

Built 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)

If you have any troubles viewing this animated gif, check out: umaar.com/dev-tips/173-query-objects
Tweet
Email Marketing Powered by MailChimp

Copyright © 2018 Umar, All rights reserved.
You are receiving this email because you signed up for Dev Tips.

unsubscribe from this list    update subscription preferences 

No comments:

Post a Comment