[WASM] Implement std print
This commit is contained in:
@@ -13,6 +13,9 @@ internal external fun printError(error: String?): Unit
|
|||||||
@JsFun("(message) => console.log(message)")
|
@JsFun("(message) => console.log(message)")
|
||||||
private external fun printlnImpl(message: String?): Unit
|
private external fun printlnImpl(message: String?): Unit
|
||||||
|
|
||||||
|
@JsFun("(message) => typeof write !== 'undefined' ? write(message) : console.log(message)")
|
||||||
|
private external fun printImpl(message: String?): Unit
|
||||||
|
|
||||||
/** Prints the line separator to the standard output stream. */
|
/** Prints the line separator to the standard output stream. */
|
||||||
public actual fun println() {
|
public actual fun println() {
|
||||||
printlnImpl("")
|
printlnImpl("")
|
||||||
@@ -25,8 +28,7 @@ public actual fun println(message: Any?) {
|
|||||||
|
|
||||||
/** Prints the given [message] to the standard output stream. */
|
/** Prints the given [message] to the standard output stream. */
|
||||||
public actual fun print(message: Any?) {
|
public actual fun print(message: Any?) {
|
||||||
// TODO: Support print without newline
|
printImpl(message?.toString())
|
||||||
println(message)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SinceKotlin("1.6")
|
@SinceKotlin("1.6")
|
||||||
|
|||||||
Reference in New Issue
Block a user