mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibWeb: Implement IDBRequest.onsuccess
This commit is contained in:
committed by
Andreas Kling
parent
fe3962a64d
commit
5ebc09c83b
@@ -105,6 +105,7 @@ namespace Web::HTML::EventNames {
|
||||
__ENUMERATE_HTML_EVENT(statechange) \
|
||||
__ENUMERATE_HTML_EVENT(storage) \
|
||||
__ENUMERATE_HTML_EVENT(submit) \
|
||||
__ENUMERATE_HTML_EVENT(success) \
|
||||
__ENUMERATE_HTML_EVENT(suspend) \
|
||||
__ENUMERATE_HTML_EVENT(timeupdate) \
|
||||
__ENUMERATE_HTML_EVENT(toggle) \
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/IDBRequestPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/IndexedDB/IDBRequest.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
@@ -25,4 +27,16 @@ void IDBRequest::initialize(JS::Realm& realm)
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBRequest);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onsuccess
|
||||
void IDBRequest::set_onsuccess(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::success, event_handler);
|
||||
}
|
||||
|
||||
// https://w3c.github.io/IndexedDB/#dom-idbrequest-onsuccess
|
||||
WebIDL::CallbackType* IDBRequest::onsuccess()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::success);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Shannon Booth <shannon@serenityos.org>
|
||||
* Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -17,6 +18,9 @@ class IDBRequest : public DOM::EventTarget {
|
||||
public:
|
||||
virtual ~IDBRequest() override;
|
||||
|
||||
void set_onsuccess(WebIDL::CallbackType*);
|
||||
WebIDL::CallbackType* onsuccess();
|
||||
|
||||
protected:
|
||||
explicit IDBRequest(JS::Realm&);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ interface IDBRequest : EventTarget {
|
||||
[FIXME] readonly attribute IDBRequestReadyState readyState;
|
||||
|
||||
// Event handlers:
|
||||
[FIXME] attribute EventHandler onsuccess;
|
||||
attribute EventHandler onsuccess;
|
||||
[FIXME] attribute EventHandler onerror;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user