Remove react from sample, force version 4 of webpack
This commit is contained in:
5 files changed
+41
-110
No files matched your search
@@ -1,34 +0,0 @@
|
||||
import com.ionspin.kotlin.crypto.hash.Hash
|
||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import react.RBuilder
|
||||
import react.RComponent
|
||||
import react.RProps
|
||||
import react.RState
|
||||
import react.ReactElement
|
||||
import react.dom.h1
|
||||
|
||||
external interface RAppState : RState {
|
||||
var currentState: String
|
||||
}
|
||||
|
||||
external interface RAppProps : RProps {
|
||||
|
||||
}
|
||||
|
||||
class App(props: RAppProps) : RComponent<RAppProps, RAppState>(props) {
|
||||
override fun RBuilder.render() {
|
||||
val hash = Hash.sha512("123".encodeToUByteArray())
|
||||
h1 {
|
||||
+"Hash (SHA512) of 123: ${hash.toHexString()}"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun RBuilder.app(handler: RAppProps.() -> Unit): ReactElement {
|
||||
return child(App::class) {
|
||||
this.attrs(handler)
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,13 @@
|
||||
|
||||
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
||||
import com.ionspin.kotlin.crypto.hash.Hash
|
||||
import com.ionspin.kotlin.crypto.util.LibsodiumRandom
|
||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import react.dom.render
|
||||
import kotlinx.browser.document
|
||||
import kotlinx.browser.window
|
||||
|
||||
|
||||
fun main() {
|
||||
val runningOnNode = jsTypeOf(window) == "undefined"
|
||||
// if (!runningOnNode) = runTest {
|
||||
LibsodiumInitializer.initializeWithCallback {
|
||||
render(document.getElementById("root")) {
|
||||
app {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else = runTest {
|
||||
// LibsodiumInitializer.initializeWithCallback {
|
||||
// val hash = Hash.sha512("123".encodeToUByteArray())
|
||||
// println("Hash (SHA512) of 123: ${hash.toHexString()}")
|
||||
// }
|
||||
// }
|
||||
LibsodiumInitializer.initializeWithCallback {
|
||||
val hash = Hash.sha512("123".encodeToUByteArray())
|
||||
println("Hash (SHA512) of 123: ${hash.toHexString()}")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user