Hello everyone. I tried to add an onclick listener...
# korge
p
Hello everyone. I tried to add an onclick listener to an image
Copy code
image.onClick {
	print("mouse clicked")
}
but nothing is getting printed. I am running korge with runJs.
1
✔️ 1
d
Change
print
with
println
then:
./gradlew clean runJs
the problem is that in javascript browsers you cannot print a partial line of text, you have to write a full line so it uses
console.log
under the hood. To do so kotlin buffers “print” calls until a new line is written. Since you were not printing any new line
\n
, nothing was shown
Copy code
print("mouse clicked\n")
// is the same as
println("mouse clicked")
p
Sorry Carlos, I was expecting the log print in my terminal but I didn't know it would be printed in the browser's console. I can see the prints. Sorry for the trouble