1. That could also be triggered by browser sidebar windows opening though. All of my browsers open dev-tools in a separate window so this is far from foolproof.
Well… you can on a lot of things. We never did .toString() on a whole lot. However, I was big on .displayName (as an override on .name which is found on functions)
My memory is fuzzy, but I also had a different function I would call if frameworks added it so instead of “Object {}” it was “Backbone.Model {id=1}”.
I put these in and used them in firebug extensions I wrote for frameworks.
Later I asked chrome to add something, which is why there is a “enable custom formatters” option for the console. Really needs to work in the debugger though.
Do you not understand that it's not your code and that their code wants toString to be called?
Someone else is writing code that they want to have react to the console opening.
So they will intentionally force the call as soon as the console is open, as a result toString is called regardless of if you yourself have made a call to it.
1. Watching window.innerHeight/innerWidth for sudden, large decreases, indicating that the user just opened the inspector.
2. Logging objects to the console with toString methods and checking if that method gets called.