Robert Munro
06/01/2021, 9:36 AMTony
06/01/2021, 4:49 PMevaluateJavascript(...)
to set a javascript variable to a javascript object using the string parameter in the function.
What I have so far:
val javascriptString = "javascript: someString = {\"key\":\"value\"}"
webView.evaluateJavascript(javascriptString, null)
This is not working. Can someone point me in the right direction?Piotr Krzemiński
06/02/2021, 11:35 AMjsGenerateExternals
from within TypeScript. A minimal example: my d.ts file starts like this
type Nullable<T> = T | null | undefined
export namespace com.example.myproject {
class CoolDto {
constructor(isDog: string);
readonly isDog: string;
// ...
and in TS I import it like this:
import { com } from '../../sharedModel';
const { CoolDto } = com.example.myproject;
type CoolDto = typeof CoolDto;
and then simply use it this way:
coolDtoInstance.isDog
but IntelliJ and TS compiler are complaining:
Property 'isDog' does not exist on type 'typeof CoolDto'. TS2339
73 |
> 74 | const isDog = coolDtoInstance.isDog;
| ^
The funny thing is that IntelliJ hints to add this field to this d.ts file, but after adding it, it still doesn't work 😕
Any ideas?Jorrit
06/02/2021, 5:34 PMid("org.jetbrains.kotlin.js") version "1.4.10"
id("kotlin2js") version "1.5.0-release-760"
And where would I find this myself?Pavel Janečka
06/02/2021, 7:33 PMdebugger
statement to final compiled JS code? That would help to debug the compiled code in browser dev tools tremendously..ankushg
06/03/2021, 2:52 AM// commonMain
interface HasFoo {
val foo: String
}
data class HasFooMobile(override val foo: String): HasFoo
// jsMain
external interface HasFooJs {
val foo: String
}
class HasFooJsWrapper(private val hasFooJs: HasFooJs): HasFoo {
override val foo = hasFooJs.foo
}
Would be nice to have some ability to declare an interface as external
in Common code and have the keyword ignored on non-JS platforms…cfnz
06/03/2021, 9:38 AMCLOVIS
06/03/2021, 1:30 PMkarma-junit-reporter
for Kotlin/JS? I assume it goes somewhere in the gradle useKarma
method, but I can't find any examples.
Apparently I just need to add --reporters junit
to the command line.Slackbot
06/03/2021, 4:04 PMsteamstreet
06/03/2021, 10:12 PMisLowerCase
? I converted my code to 1.5, did the migrations of deprecated functions, but that was the only one that is causing me problems at runtime:steamstreet
06/03/2021, 10:14 PMlowercase()
function, also introduced in 1.5 is working fine.dvdandroid
06/04/2021, 7:07 AMCLOVIS
06/04/2021, 8:45 AMroot
element, which doesn't exist during tests because it's not executed from the HTML file. What can I do?
I'm using the legacy compiler with binaries.executable
, if that makes a difference.MrPowerGamerBR
06/04/2021, 1:38 PMjsBrowserDistribution
output to another project?
What I want to do is to copy the output from my :frontend
module to the resources of my :backend
(a ktor webserver) moduleJeff Davidson
06/04/2021, 4:48 PMsuspend fun executeScript(frameId: Int): String {
val result = js("browser.tabs.executeScript({ frameId: frameId, code: 'window.location.href' })") as Promise<String>
return try {
result.await()
} catch (t: Throwable) {
// Never gets invoked
console.error("Got error in await:", t.message)
""
}
}
Nikky
06/05/2021, 5:55 PM^1.20
instead of 1.2.0
because without ^
it would pin it and transitive dependencies cannot raise it ?
is there any case where you would want to have a npm version without ^
prefixed ?
context: working on adding support for npm to #gradle-refresh-versionsGreg Steckman
06/05/2021, 7:51 PMbsimmons
06/07/2021, 11:38 AM<div>
across the screen using top
and left
css properties on mousedown. Using kotlin-react and styled components takes around 1000 times longer (most of the time from recalculating styles) than a pure JS solution that simply changes the inline <div>
style.)Robert Jaros
06/07/2021, 4:59 PMRobert Munro
06/07/2021, 7:55 PMval commonMain by getting {
dependencies {
implementation(project(":shared"))
implementation("org.jetbrains.kotlinx:kotlinx-datetime:$ver_kotlinx_datetime")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$ver_kotlinx_serialization_core")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$ver_kotlinx_serialization_core")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$ver_coroutines_core")
implementation("io.ktor:ktor-client-core:$ver_ktor")
implementation("io.insert-koin:koin-core:$ver_koin")
}
}
val jsMain by getting {
dependencies {
implementation("org.jetbrains:kotlin-react:$ver_kotlin_react")
implementation("org.jetbrains:kotlin-styled:$ver_kotlin_styled")
implementation(npm("react-youtube-lite", "1.0.1"))
implementation(npm("react-share", "~4.2.1"))
// todo shouldn't be need but breaks build runtime/webpack
//implementation(npm("kotlinx-serialization-kotlinx-serialization-core-jslegacy", "1.4.2-RC1"))
implementation("com.ccfraser.muirwik:muirwik-components:0.7.0") {
exclude(group = "org.jetbrains.kotlin-wrappers", module = "kotlin-styled")
}
//<https://github.com/CookPete/react-player>
//implementation(npm("react-player", "2.9.0"))
}
//implementation("org.jetbrains.kotlinx:kotlinx-datetime-js:$ver_kotlinx_datetime")
}
versions are
ver_kotlin_react=17.0.1-pre.148-kotlin-1.4.21
ver_kotlin_styled=5.2.1-pre.146-kotlin-1.4.30
ver_react=17.0.1
ver_styled_cmp=5.3.0
ver_kotlin=1.4.32
the errors i get are:Robert Munro
06/07/2021, 7:55 PMAyfri
06/07/2021, 10:23 PMxxfast
06/08/2021, 4:09 AMSubroh Nishikori
06/08/2021, 4:31 PM1.4.32
, but when I updated to Kotlin 1.5.x
, I was unable to resolve the @material-ui/core
dependency.
You can find it in the following repository ./gradlew :sample:run
command in the following repository. Any ideas on how to fix this would be great!Nikky
06/08/2021, 9:05 PMRecord<String, Any>
, it works when i pass it a think like so :
js("{name: \"Anna\"}")
but i would really like to call it with mapOf()
or similar
any idea how i can achieve that ?Dave
06/09/2021, 6:38 AMrnett
06/10/2021, 1:30 AMArjan van Wieringen
06/10/2021, 12:00 PMconfig.devServer = {
historyApiFallback: true,
}
in my JsBrowserDevelopmentRun task? I've placed the snippet into a js file in the folder webpack.config.d
but I can't get it to workArjan van Wieringen
06/10/2021, 12:01 PMconfig.devServer["historyApiFallback"] = true
Akram Bensalem
06/10/2021, 9:33 PMAkram Bensalem
06/10/2021, 9:33 PMRobert Jaros
06/10/2021, 9:36 PM