mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibWeb: Implement ServiceWorkerContainer.onmessage
This commit is contained in:
committed by
Tim Ledbetter
parent
820676857a
commit
4b1273cbde
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -7,6 +8,7 @@
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/ServiceWorkerContainerPrototype.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/HTML/ServiceWorkerContainer.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
@@ -29,4 +31,16 @@ JS::NonnullGCPtr<ServiceWorkerContainer> ServiceWorkerContainer::create(JS::Real
|
||||
return realm.heap().allocate<ServiceWorkerContainer>(realm, realm);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-onmessage
|
||||
WebIDL::CallbackType* ServiceWorkerContainer::onmessage()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::message);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#dom-serviceworkercontainer-onmessage
|
||||
void ServiceWorkerContainer::set_onmessage(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::message, event_handler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user