We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 11521a7 commit c84eb29Copy full SHA for c84eb29
vlib/builtin/js/builtin.js.v
@@ -9,9 +9,10 @@ pub fn js_throw(s any) {
9
for {}
10
}
11
12
-#let globalPrint;
+#let globalPrint, globalWrite;
13
$if js_freestanding {
14
#globalPrint = globalThis.print
15
+ #globalWrite = (typeof globalThis.write === 'function')? write: globalThis.print
16
17
18
pub fn flush_stdout() {
@@ -33,6 +34,8 @@ pub fn println(s string) {
33
34
pub fn print(s string) {
35
$if js_node {
36
#$process.stdout.write(s.str)
37
+ } $else $if js_freestanding {
38
+ #globalWrite(s.str)
39
} $else {
40
panic('Cannot `print` in a browser, use `println` instead')
41
0 commit comments