0

Is there a way to read/assign the results of console.dir(object) into a variable for processing in my own javascript code?

Thanks in advance.

klng
  • 11
  • 2
  • no, that's a security risk (console ignores some restrictions), so there's no way to reach such results. – dandavis Apr 17 '18 at 06:54
  • i see.. thanks. is there a javascript function/library equipvalent for console.dir? that can do what I want? – klng Apr 17 '18 at 06:57
  • 2
    What are you trying to achieve? – ansibly Apr 17 '18 at 06:58
  • you can use a template to turn Object.entries(obj) into interactive HTML – dandavis Apr 17 '18 at 06:58
  • trying to create a simple intellisense editor and a watch variables console in my html page – klng Apr 17 '18 at 07:00
  • thanks dandavis.. tried using Object.entries(obj) on a DOM label object.. but can't get list of events associated with it. (eg. onclick, ondblclick, etc..) – klng Apr 17 '18 at 07:06
  • Sounds not exactly like, but similar enough to: https://stackoverflow.com/questions/11455515/how-to-check-whether-dynamically-attached-event-listener-exists-or-not – ansibly Apr 17 '18 at 07:15
  • yeah, events are not iterable afaik, given an elm; you'd have to mod the subscriber mechanism (ex addEventListener) to log each binding, and even then, you won't catch delegated events without great effort – dandavis Apr 17 '18 at 07:17

0 Answers0