0

I need to analyze the object created by Angular in the blur event. I've logged it in the console but the object is rather big and it's hard to follow, as the properties aren't directly visible and I have to click each one to know the contents.

FocusEvent {isTrusted: true, relatedTarget: null, view: Window, detail: 0, sourceCapabilities: InputDeviceCapabilities, …}
bubbles: false
cancelBubble: false
cancelable: false
composed: true
currentTarget: null
defaultPrevented: false
detail: 0
eventPhase: 0
isTrusted: true
path: (14) [input.table-cell, td, tr, tbody.ui-table-tbody, table, div.ui-table-wrapper, div.ui-table.ui-widget, p-table, app-table-test, app-root, body, html, document, Window]
relatedTarget: null
returnValue: true
sourceCapabilities: InputDeviceCapabilities {firesTouchEvents: false}
srcElement: input.table-cell
target: input.table-cell
timeStamp: 6538.540000008652
type: "blur"
view: Window {parent: Window, postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, …}
which: 0
__proto__: FocusEvent

To this end, I've used JSON.stringify to turn it into a string that I can copy into the clipboard (and then a text editor), but its only output is an object with just one property, namely, it shows {isTrusted: true}. That's it.

I've read that stringify only shows own properties, and I wonder if there is a way I can make it print everything.

JD Gamboa
  • 362
  • 4
  • 20
  • Does this answer your question? [How to stringify event object?](https://stackoverflow.com/questions/11547672/how-to-stringify-event-object) – Easwar Nov 29 '19 at 20:42

1 Answers1

0

Just try these simple steps :

  • Evaluate expression/variable you want to copy, for eg: you want to copy "FocusEventObject", then hover over "FocusEventObject" from your code source and hit ctrl + shift + e, or if you have printed in console.log(), then follow next steps
  • This evaluated expression will gets printed in the console, then right-click on the object and select "Store as global variable", and follow the next step
  • After clicking on "Store as global variable", it will create a "temp1" variable and prints in console, then run this command, "copy(temp1)". In this way, you can copy the entire object to the clipboard, and use anywhere in system.
Sarvesh Mahajan
  • 914
  • 7
  • 16