Skip to content

Commit

Permalink
add group_collapsed function executing group inside it (#3867)
Browse files Browse the repository at this point in the history
  • Loading branch information
leoflalv authored May 28, 2024
1 parent 26b1f69 commit fd1a348
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion core/runtime/src/console/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ impl Console {
0,
)
.function(
console_method_mut(Self::group, state.clone()),
console_method_mut(Self::group_collapsed, state.clone()),
js_string!("groupCollapsed"),
0,
)
Expand Down Expand Up @@ -658,6 +658,25 @@ impl Console {
Ok(JsValue::undefined())
}

/// `console.groupCollapsed(...data)`
///
/// Adds new group collapsed with name from formatted data to stack.
///
/// More information:
/// - [MDN documentation][mdn]
/// - [WHATWG `console` specification][spec]
///
/// [spec]: https://console.spec.whatwg.org/#groupcollapsed
/// [mdn]: https://developer.mozilla.org/en-US/docs/Web/API/console/groupcollapsed_static
fn group_collapsed(
_: &JsValue,
args: &[JsValue],
console: &mut Self,
context: &mut Context,
) -> JsResult<JsValue> {
Console::group(&JsValue::Undefined, args, console, context)
}

/// `console.groupEnd(label)`
///
/// Removes the last group from the stack.
Expand Down

0 comments on commit fd1a348

Please sign in to comment.