mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 03:15:08 +00:00
LibWeb: Add XMLHttpRequest.readyState and constants
This commit is contained in:
parent
3c9693c6c7
commit
602a36970f
5 changed files with 46 additions and 0 deletions
|
@ -40,6 +40,14 @@ class XMLHttpRequest final
|
|||
, public EventTarget
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
enum class ReadyState {
|
||||
Unsent,
|
||||
Opened,
|
||||
HeadersReceived,
|
||||
Loading,
|
||||
Done,
|
||||
};
|
||||
|
||||
using WrapperType = Bindings::XMLHttpRequestWrapper;
|
||||
|
||||
static NonnullRefPtr<XMLHttpRequest> create(Window& window) { return adopt(*new XMLHttpRequest(window)); }
|
||||
|
@ -49,6 +57,7 @@ public:
|
|||
using RefCounted::ref;
|
||||
using RefCounted::unref;
|
||||
|
||||
ReadyState ready_state() const { return m_ready_state; };
|
||||
String response_text() const;
|
||||
void open(const String& method, const String& url);
|
||||
void send();
|
||||
|
@ -58,10 +67,14 @@ private:
|
|||
virtual void unref_event_target() override { unref(); }
|
||||
virtual void dispatch_event(NonnullRefPtr<Event>) override;
|
||||
|
||||
void set_ready_state(ReadyState);
|
||||
|
||||
explicit XMLHttpRequest(Window&);
|
||||
|
||||
NonnullRefPtr<Window> m_window;
|
||||
|
||||
ReadyState m_ready_state { ReadyState::Unsent };
|
||||
|
||||
String m_method;
|
||||
String m_url;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue