mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
LibJS+WebContent+Browser+js: Implement console.group() methods
This implements: - console.group() - console.groupCollapsed() - console.groupEnd() In the Browser, we use `<details>` for the groups, which is not actually implemented yet, so groups are always open. In the REPL, groups are non-interactive, but still indent any output. This looks weird since the console prompt and return values remain on the far left, but this matches what Node does so it's probably fine. :^) I expect `console.group()` is not used much outside of browsers.
This commit is contained in:
parent
ff5e07d718
commit
d702678d16
10 changed files with 281 additions and 25 deletions
|
@ -25,7 +25,7 @@ public:
|
|||
|
||||
private:
|
||||
virtual void clear() override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, Variant<Vector<JS::Value>, JS::Console::Trace>) override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments) override;
|
||||
|
||||
ClientConnection& m_client;
|
||||
WeakPtr<JS::Interpreter> m_interpreter;
|
||||
|
@ -33,14 +33,19 @@ private:
|
|||
|
||||
void clear_output();
|
||||
void print_html(String const& line);
|
||||
void begin_group(String const& label, bool start_expanded);
|
||||
virtual void end_group() override;
|
||||
|
||||
struct ConsoleOutput {
|
||||
enum class Type {
|
||||
HTML,
|
||||
Clear
|
||||
Clear,
|
||||
BeginGroup,
|
||||
BeginGroupCollapsed,
|
||||
EndGroup,
|
||||
};
|
||||
Type type;
|
||||
String html;
|
||||
String data;
|
||||
};
|
||||
Vector<ConsoleOutput> m_message_log;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue