mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 00:19:27 +00:00
LibWeb: Implement IDBRequest.onsuccess
(cherry picked from commit 5ebc09c83b5ffd75341f8ddca9db3a49f587ed8d)
This commit is contained in:
parent
2f0b9c6dab
commit
6d268be6fc
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue