mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:37:46 +00:00
LibWeb: Add EventTarget::has_event_listener(FlyString type)
This returns true if the EventTarget has one or more registered listeners for a given even type.
This commit is contained in:
parent
51579810bd
commit
e0a08f2ab0
2 changed files with 11 additions and 0 deletions
|
@ -735,4 +735,13 @@ bool EventTarget::dispatch_event(Event& event)
|
|||
return EventDispatcher::dispatch(*this, event);
|
||||
}
|
||||
|
||||
bool EventTarget::has_event_listener(FlyString const& type) const
|
||||
{
|
||||
for (auto& listener : m_event_listener_list) {
|
||||
if (listener->type == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue