node and browser bindings for gleam
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add group functions from the Console API

+38
+12
src/console_ffi.mjs
··· 25 25 export function clear() { 26 26 console.clear(); 27 27 } 28 + 29 + export function group(label) { 30 + console.group(label); 31 + } 32 + 33 + export function group_collapsed(label) { 34 + console.groupCollapsed(label); 35 + } 36 + 37 + export function group_end() { 38 + console.groupEnd(); 39 + }
+18
src/plinth/javascript/console.gleam
··· 32 32 /// and will have no effect (and no error). 33 33 @external(javascript, "../../console_ffi.mjs", "clear") 34 34 pub fn clear() -> Nil 35 + 36 + /// Creates a new inline group in the Web console log, 37 + /// causing any subsequent console messages to be indented by an additional level, 38 + /// until `console.group_end` is called. 39 + @external(javascript, "../../console_ffi.mjs", "group") 40 + pub fn group(label: String) -> Nil 41 + 42 + /// reates a new inline group in the console. Unlike `console.group`, however, 43 + /// the new group is created collapsed. The user will need to use the disclosure 44 + /// button next to it to expand it, revealing the entries created in the group. 45 + /// 46 + /// Call `console.group_end` to back out to the parent group. 47 + @external(javascript, "../../console_ffi.mjs", "group_collapsed") 48 + pub fn group_collapsed(label: String) -> Nil 49 + 50 + /// Exits the current inline group in the console 51 + @external(javascript, "../../console_ffi.mjs", "group_end") 52 + pub fn group_end() -> Nil
+8
test/javascript/node/console_test.gleam
··· 27 27 pub fn assert_fail_test() { 28 28 console.assert_(False, "You should see this!") 29 29 } 30 + 31 + pub fn group_test() { 32 + console.group("test label") 33 + console.log("Inside the group") 34 + console.log("Also inside the group") 35 + console.group_end() 36 + console.log("Outside the group") 37 + }