/* * Copyright (c) 2021, Brandon Scott * Copyright (c) 2020, Hunter Salyer * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include "ClientConnection.h" #include #include #include #include namespace WebContent { class WebContentConsoleClient final : public JS::ConsoleClient { public: WebContentConsoleClient(JS::Console& console, WeakPtr interpreter, ClientConnection& client) : ConsoleClient(console) , m_client(client) , m_interpreter(interpreter) { } void handle_input(const String& js_source); private: virtual JS::Value log() override; virtual JS::Value info() override; virtual JS::Value debug() override; virtual JS::Value warn() override; virtual JS::Value error() override; virtual JS::Value clear() override; virtual JS::Value trace() override; virtual JS::Value count() override; virtual JS::Value count_reset() override; virtual JS::Value assert_() override; ClientConnection& m_client; WeakPtr m_interpreter; void clear_output(); void print_html(const String& line); }; }