event-override
The event-override
snippet proxies events and event handlers to defuse events or change their attributes. It works with the principle of proxying addEventHandler function and the original Event class with a CustomEvent class that we control. This way we can defuse/change any arbitrary event or create new ones.
Parameters
eventType
The type of the event to target. Examples: click, mouseover, someCustomEvent
Yes
n.a.
mode
The mode of the operation. Accepts: “trusted“, “disable“. trusted mode makes the event property isTrusted true. disable mode: Disables the matching event.
Yes
n.a.
needle
Needle to look for in the event listener function.
No
''
Filter examples
event-override click disable
Will disable all event listeners for the click event.
event-override someCustomEvent disable
Will disable all event listeners for the onAbnormalityDetected event.
event-override click trusted serveAd
Will make the isTrusted attribute true for the click events that have the string “serveAd“ in their event listener function.
Last updated
Was this helpful?