node and browser bindings for gleam

Add console.clear from the Console API

Can't keep this in the tests, as it (successfully) clears the test results

Changed files
+11
src
plinth
javascript
+4
src/console_ffi.mjs
··· 21 21 export function assert(assertion, value) { 22 22 console.assert(assertion, value); 23 23 } 24 + 25 + export function clear() { 26 + console.clear(); 27 + }
+7
src/plinth/javascript/console.gleam
··· 25 25 /// If the assertion is true, nothing happens. 26 26 @external(javascript, "../../console_ffi.mjs", "assert") 27 27 pub fn assert_(assertion: Bool, value: a) -> Nil 28 + 29 + /// clears the console if the console allows it. A graphical console, 30 + /// like those running on browsers, will allow it; a console displaying 31 + /// on the terminal, like the one running on Node, will not support it, 32 + /// and will have no effect (and no error). 33 + @external(javascript, "../../console_ffi.mjs", "clear") 34 + pub fn clear() -> Nil