Previously we were inconsistent by generating code for enum definitions but not generating code for dictionaries. With future changes to the IDL generator to expose helpers to convert to and from IDL values this produced circular depdendencies. To solve this problem, also generate the dictionary definitions in bindings headers.
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
/*
|
|
* Copyright (c) 2025, Edwin Hoksberg <mail@edwinhoksberg.nl>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/Serial.h>
|
|
#include <LibWeb/DOM/EventTarget.h>
|
|
#include <LibWeb/WebIDL/Types.h>
|
|
|
|
namespace Web::Serial {
|
|
|
|
// https://wicg.github.io/serial/#serial-interface
|
|
class Serial : public DOM::EventTarget {
|
|
WEB_PLATFORM_OBJECT(Serial, DOM::EventTarget);
|
|
GC_DECLARE_ALLOCATOR(Serial);
|
|
|
|
public:
|
|
// https://wicg.github.io/serial/#requestport-method
|
|
WebIDL::ExceptionOr<GC::Ref<WebIDL::Promise>> request_port(Bindings::SerialPortRequestOptions const& = {});
|
|
// https://wicg.github.io/serial/#getports-method
|
|
GC::Ref<WebIDL::Promise> get_ports();
|
|
|
|
// https://wicg.github.io/serial/#onconnect-attribute
|
|
void set_onconnect(WebIDL::CallbackType*);
|
|
WebIDL::CallbackType* onconnect();
|
|
|
|
// https://wicg.github.io/serial/#ondisconnect-attribute
|
|
void set_ondisconnect(WebIDL::CallbackType*);
|
|
WebIDL::CallbackType* ondisconnect();
|
|
|
|
private:
|
|
explicit Serial(JS::Realm&);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
};
|
|
|
|
}
|