From fce6c2af50b4ae25dfe4c82932492df7cc433969 Mon Sep 17 00:00:00 2001 From: bptato Date: Sat, 27 May 2023 17:14:22 +0200 Subject: Add some console functions to DOM Mainly to avoid errors --- src/html/dom.nim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/html/dom.nim b/src/html/dom.nim index 4bc76a0a..600639ee 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -2002,6 +2002,23 @@ proc log*(console: console, ss: varargs[string]) {.jsfunc.} = console.err.write('\n') console.err.flush() +proc clear*(console: console) {.jsfunc.} = + # Do nothing. By design, we do not allow buffers to clear the console. + discard + +# For now, these are the same as log(). +proc debug*(console: console, ss: varargs[string]) {.jsfunc.} = + console.log(ss) + +proc error*(console: console, ss: varargs[string]) {.jsfunc.} = + console.log(ss) + +proc info*(console: console, ss: varargs[string]) {.jsfunc.} = + console.log(ss) + +proc warn*(console: console, ss: varargs[string]) {.jsfunc.} = + console.log(ss) + proc execute*(element: HTMLScriptElement) = let document = element.document if document != element.preparationTimeDocument: -- cgit 1.4.1-2-gfad0