mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 06:38:10 +00:00
LibWeb: Add EventTarget.removeEventListener()
This commit is contained in:
parent
d724a12732
commit
244b243d22
3 changed files with 9 additions and 0 deletions
|
@ -42,4 +42,11 @@ void EventTarget::add_event_listener(const FlyString& event_name, NonnullRefPtr<
|
|||
m_listeners.append({ event_name, move(listener) });
|
||||
}
|
||||
|
||||
void EventTarget::remove_event_listener(const FlyString& event_name, NonnullRefPtr<EventListener> listener)
|
||||
{
|
||||
m_listeners.remove_first_matching([&](auto& entry) {
|
||||
return entry.event_name == event_name && &entry.listener->function() == &listener->function();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue