From f13f684f163c9a63f3c00848700defc75ea671b6 Mon Sep 17 00:00:00 2001 From: saqimtiaz Date: Thu, 30 Jan 2025 13:15:12 +0100 Subject: [PATCH] feat(eventcatcher): provide access to event properties as JSON --- core/modules/widgets/eventcatcher.js | 43 ---------------------------- 1 file changed, 43 deletions(-) diff --git a/core/modules/widgets/eventcatcher.js b/core/modules/widgets/eventcatcher.js index fffd8949f..bd80b1bfa 100644 --- a/core/modules/widgets/eventcatcher.js +++ b/core/modules/widgets/eventcatcher.js @@ -23,49 +23,6 @@ Inherit from the base widget class */ EventWidget.prototype = new Widget(); - -function getEventPropertiesJSON(event) { - var seen = new Set(); - - function isDOMElement(value) { - return value instanceof Node || value instanceof Window; - } - - function safeCopy(obj) { - //skip ciruclar references - if(seen.has(obj)) { - return "[Circular reference]"; - } - //skip functions - if(typeof obj !== "object" || obj === null) { - return obj; - } - //skip DOM elements - if(isDOMElement(obj)) { - return "[DOM Element]"; - } - //copy each element of the array - if(Array.isArray(obj)) { - return obj.map(safeCopy); - } - - seen.add(obj); - var copy = {}, key; - for(key in obj) { - try{ - copy[key] = safeCopy(obj[key]); - } catch(e) { - copy[key] = "[Unserializable]"; - } - } - return copy; - } - - var result = safeCopy(event); - seen.clear(); - return result; -}; - /* Render this widget into the DOM */