Remove react from sample, force version 4 of webpack
This commit is contained in:
5 files changed
+41
-110
No files matched your search
+32
-44
@@ -60,28 +60,28 @@ kotlin {
|
||||
android()
|
||||
runningOnLinuxx86_64 {
|
||||
jvm()
|
||||
// js(IR) {
|
||||
// browser {
|
||||
// webpackTask {
|
||||
//
|
||||
// }
|
||||
// testTask {
|
||||
// useKarma {
|
||||
// useChrome()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// nodejs {
|
||||
// testTask {
|
||||
// useMocha() {
|
||||
// timeout = "10s"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
js(IR) {
|
||||
browser {
|
||||
webpackTask {
|
||||
|
||||
// binaries.executable()
|
||||
}
|
||||
testTask {
|
||||
useKarma {
|
||||
useChrome()
|
||||
}
|
||||
}
|
||||
}
|
||||
nodejs {
|
||||
testTask {
|
||||
useMocha() {
|
||||
timeout = "10s"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
binaries.executable()
|
||||
|
||||
}
|
||||
|
||||
|
||||
linuxX64("linux") {
|
||||
@@ -284,30 +284,18 @@ kotlin {
|
||||
implementation(kotlin(Deps.Jvm.reflection))
|
||||
}
|
||||
}
|
||||
// val jsMain by getting {
|
||||
// dependencies {
|
||||
// implementation(kotlin(Deps.Js.stdLib))
|
||||
// implementation(Deps.Js.coroutines)
|
||||
//
|
||||
//
|
||||
// // React
|
||||
// implementation(Deps.Js.React.react)
|
||||
// implementation(Deps.Js.React.reactDom)
|
||||
//// implementation(npm(Deps.Js.Npm.reactPair.first, Deps.Js.Npm.reactPair.second))
|
||||
//// implementation(npm(Deps.Js.Npm.reactDomPair.first, Deps.Js.Npm.reactDomPair.second))
|
||||
//
|
||||
// // Styled
|
||||
// implementation(Deps.Js.React.styled)
|
||||
//// implementation(npm(Deps.Js.Npm.styledComponentsPair.first, Deps.Js.Npm.styledComponentsPair.second))
|
||||
//// implementation(npm(Deps.Js.Npm.inlineStylePrefixesPair.first, Deps.Js.Npm.inlineStylePrefixesPair.second))
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// val jsTest by getting {
|
||||
// dependencies {
|
||||
// implementation(kotlin(Deps.Js.test))
|
||||
// }
|
||||
// }
|
||||
val jsMain by getting {
|
||||
dependencies {
|
||||
implementation(kotlin(Deps.Js.stdLib))
|
||||
implementation(Deps.Js.coroutines)
|
||||
|
||||
}
|
||||
}
|
||||
val jsTest by getting {
|
||||
dependencies {
|
||||
implementation(kotlin(Deps.Js.test))
|
||||
}
|
||||
}
|
||||
|
||||
val linuxMain by getting {
|
||||
dependsOn(nativeMain)
|
||||
|
||||
@@ -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