ghedeon
01/08/2019, 12:25 AMval foo by viewModels()
. But now I don't need the whole object, but only a field from it: val foo by viewModel().bar
ghedeon
01/08/2019, 12:26 AMviewModel()
is lazyghedeon
01/08/2019, 12:26 AMviewModel().value.bar
I'll lose the lazynessghedeon
01/08/2019, 12:27 AMkarelpeeters
01/08/2019, 12:27 AMprivate val bar by viewModel()
val foo by lazy { bar.value }
ghedeon
01/08/2019, 12:28 AMval foo by lazy { viewModel().value }
ghedeon
01/08/2019, 12:29 AMuser
04/06/2021, 9:20 AMuser
04/06/2021, 3:43 PMDhanya S Pillai
04/07/2021, 11:47 AMuser
04/07/2021, 3:27 PMuser
04/07/2021, 6:08 PMuser
04/08/2021, 9:10 AMuser
04/08/2021, 1:33 PMuser
04/08/2021, 3:39 PMuser
04/09/2021, 3:24 PMColm Murphy
04/09/2021, 8:09 PMsrc
directory, it doesn't prompt me to create a commonMain/kotlin or commonMain/resources directory. My build.gradle.kts looks like this, afaik I should have everything configured properly
plugins {
kotlin("multiplatform") version "1.4.31"
application
kotlin("plugin.serialization") version "1.4.31"
}
val ktorVersion = "1.5.2"
val kotlinVersion = "1.4.31"
apply(plugin = "kotlinx-serialization")
group = "xyz.colmmurphy"
version = "0.1.1"
repositories {
maven { setUrl("<https://dl.bintray.com/kotlin/kotlin-eap>") }
maven { setUrl("<https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-eap/>")}
maven("<https://kotlin.bintray.com/kotlin-js-wrappers/>")
maven { setUrl("<https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers/>")}
mavenCentral()
jcenter()
}
kotlin {
js {
browser {
binaries.executable()
commonWebpackConfig {
cssSupport.enabled = true
}
}
}
jvm {
withJava()
val jvmJar by tasks.getting(org.gradle.jvm.tasks.Jar::class) {
doFirst {
manifest {
attributes["Main-Class"] = "ServerKt"
}
from(configurations.getByName("runtimeClasspath").map { if (it.isDirectory) it else zipTree(it) })
}
val taskName = if (project.hasProperty("isProduction")) {
"jsBrowserProductionWebpack"
} else {
"jsBrowserDevelopmentWebpack"
}
val webpackTask = tasks.getByName<org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack>(taskName)
dependsOn(webpackTask) // make sure JS gets compiled first
from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
}
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0")
implementation("io.ktor:ktor-client-core:$ktorVersion")
}
}
val jvmMain by getting {
dependencies {
// MongoDB
implementation("org.mongodb:mongodb-driver-sync:4.2.3")
//implementation("org.litote.kmongo:kmongo:4.2.5")
// Ktor
implementation("io.ktor:ktor-server-core:${ktorVersion}")
implementation("io.ktor:ktor-server-netty:${ktorVersion}")
implementation("io.ktor:ktor-serialization:${ktorVersion}")
implementation("io.ktor:ktor-websockets:$ktorVersion")
implementation("io.ktor:ktor-html-builder:$ktorVersion")
implementation("ch.qos.logback:logback-classic:1.2.3")
implementation("org.jetbrains:kotlin-css-jvm:1.0.0-pre.150-kotlin-1.4.31")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
}
}
val jsMain by getting {
dependencies {
//include http&websockets
implementation("io.ktor:ktor-client-js:$ktorVersion")
//ktor client js json
implementation("io.ktor:ktor-client-json-js:$ktorVersion")
implementation("io.ktor:ktor-client-serialization-js:$ktorVersion")
// React Kotlin wrapper
implementation("org.jetbrains:kotlin-react:17.0.2-pre.150-kotlin-1.4.31")
implementation("org.jetbrains:kotlin-react-dom:17.0.2-pre.150-kotlin-1.4.31")
implementation(npm("react", "17.0.2"))
implementation(npm("react-dom", "17.0.2"))
// implementation("org.jetbrains:kotlin-react:16.13.1-pre.110-kotlin-1.4.0")
// implementation("org.jetbrains:kotlin-react-dom:16.13.1-pre.110-kotlin-1.4.0")
// implementation(npm("react", "16.13.1"))
// implementation(npm("react-dom", "16.13.1"))
//Kotlin Styled
implementation("org.jetbrains:kotlin-styled:5.2.1-pre.148-kotlin-1.4.21")
implementation(npm("styled-components", "~5.2.1"))
//Video Player & Share Buttons
implementation(npm("react-youtube-lite", "1.0.1"))
implementation(npm("react-share", "~4.2.1"))
//Coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
}
}
application {
mainClassName = "ServerKt"
}
F0X
04/10/2021, 9:33 AMConfig
object that holds the config data and can reload it from file. How would I best do the synchronization for this to be thread-safe?
Edit: I now just went with a simple ReentrantReadWriteLock
user
04/10/2021, 5:26 PMuser
04/11/2021, 12:46 PMuser
04/12/2021, 2:05 PMvishal G
04/12/2021, 6:40 PMuser
04/13/2021, 9:15 AMuser
04/13/2021, 11:43 AMuser
04/14/2021, 8:49 AMuser
04/14/2021, 3:09 PMJustin Tullgren
04/14/2021, 3:43 PMuser
04/14/2021, 4:13 PMJustin Tullgren
04/14/2021, 4:14 PMobject Registrant {
// does not work
init { Registrar.register(this) }
}
user
04/14/2021, 7:10 PMkotlin-test
Try the new APIs on your real-life projects and share your feedback!
https://t.co/IRcmkR1cvN
Twitter