mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Add IDBTransaction
This commit is contained in:
parent
16ce2b975a
commit
20a92a81c4
Notes:
github-actions[bot]
2024-11-26 13:52:51 +00:00
Author: https://github.com/stelar7
Commit: 20a92a81c4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2236
Reviewed-by: https://github.com/gmta ✅
8 changed files with 168 additions and 0 deletions
71
Libraries/LibWeb/IndexedDB/IDBTransaction.cpp
Normal file
71
Libraries/LibWeb/IndexedDB/IDBTransaction.cpp
Normal file
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (c) 2024, stelar7 <dudedbz@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/HTML/EventNames.h>
|
||||
#include <LibWeb/IndexedDB/IDBTransaction.h>
|
||||
|
||||
namespace Web::IndexedDB {
|
||||
|
||||
GC_DEFINE_ALLOCATOR(IDBTransaction);
|
||||
|
||||
IDBTransaction::~IDBTransaction() = default;
|
||||
|
||||
IDBTransaction::IDBTransaction(JS::Realm& realm, GC::Ref<IDBDatabase> database)
|
||||
: EventTarget(realm)
|
||||
, m_connection(database)
|
||||
{
|
||||
}
|
||||
|
||||
GC::Ref<IDBTransaction> IDBTransaction::create(JS::Realm& realm, GC::Ref<IDBDatabase> database)
|
||||
{
|
||||
return realm.create<IDBTransaction>(realm, database);
|
||||
}
|
||||
|
||||
void IDBTransaction::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(IDBTransaction);
|
||||
}
|
||||
|
||||
void IDBTransaction::visit_edges(Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_connection);
|
||||
visitor.visit(m_error);
|
||||
}
|
||||
|
||||
void IDBTransaction::set_onabort(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::abort, event_handler);
|
||||
}
|
||||
|
||||
WebIDL::CallbackType* IDBTransaction::onabort()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::abort);
|
||||
}
|
||||
|
||||
void IDBTransaction::set_oncomplete(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::complete, event_handler);
|
||||
}
|
||||
|
||||
WebIDL::CallbackType* IDBTransaction::oncomplete()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::complete);
|
||||
}
|
||||
|
||||
void IDBTransaction::set_onerror(WebIDL::CallbackType* event_handler)
|
||||
{
|
||||
set_event_handler_attribute(HTML::EventNames::error, event_handler);
|
||||
}
|
||||
|
||||
WebIDL::CallbackType* IDBTransaction::onerror()
|
||||
{
|
||||
return event_handler_attribute(HTML::EventNames::error);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue