I need to serialize a MouseEvent to JSON but:
canvas.addEventListener('mousedown', function (e) {
console.log(JSON.stringify(e))
});
prints only the first element of the event:
{"isTrusted": true}
I expected it to convert the whole MouseEvent to JSON including stuff like offsetX
, offsetY
.
I already tried limiting JSON stringification depth and removing circular structures with dojox.json.ref, JSON-js, this, this and a few other ways. I figured circular structures were probably not the issue.
I currently work around it using this approach but there must be a better way.