Slackbot
07/08/2021, 1:05 PMPitel
07/08/2021, 1:08 PMwindow.customElements.define("m3-stars", Stars::class.js.unsafeCast<() -> dynamic>())
Any idea why this fails? Browser says the second parametr is not a function. The code is from https://docs.fritz2.dev/WebComponents.html#use-webcomponentsМарк Вавилов
07/08/2021, 4:05 PMIlya Kalibrov [JB]
07/09/2021, 9:56 AMTristan
07/09/2021, 6:58 PMmethod can't be invoked on a non-injected object
Looking on Google, I found this: https://bugs.chromium.org/p/chromium/issues/detail?id=514628
So I looked into the code generated, and indeed, we are not doing what they recommend. The code generated gives:
var tmp0_safe_receiver = Native.adOver;
return tmp0_safe_receiver == null ? null : tmp0_safe_receiver();
For
external object Native {
val adOver: (() -> Unit)?
}
Native.adOver?.invoke()
According to the report, we should generate:
var tmp0_safe_receiver = Native.adOver.bind(Native);
Has it been reported yet? Is there a workaround (other than just use js("Native.adOver?.()")
)alexandrepiveteau
07/10/2021, 6:24 PMexternal
definitions from an existing npm module, but can’t figure out something. How should the following Typescript definition be declared in Kotlin ? [Symbol.iterator]!: () => Iterator<string>
Alex Ostrovsky
07/11/2021, 2:21 AM{({ onItemsRendered, ref }) => (
is there a way to express that in Kotlin JS?Jonathan Sandusky
07/12/2021, 6:31 PMstable
The multiplatform is listed as alpha
. Also, when building the application can I compile/transpile JVM and Javascript? Or is this project solely for writing in Kotlin and outputting JS, not both jvm/js?Robert Munro
07/13/2021, 1:45 PMankushg
07/13/2021, 8:57 PMkeep
everything that is annotated with @JsExport
? Right now we're manually maintaining a list in dceTask { keep(…) }
, and it's kinda annoying to do so manually.
I know it's possible to write some code to generate the keep declarations for us, but figured it was worth asking the broader community first 😄Robert Munro
07/15/2021, 7:29 AMEtienne
07/16/2021, 7:03 PMjson {"key1":"value1", "key2":"value2", "key3":"value3" }
into a Kotlin type.Pitel
07/19/2021, 10:55 AMRobert Jaros
07/20/2021, 7:20 AMClassCastException
error on 1.5.21:
console.log(delay(5))
(it can be any suspending function inside console.log(...)
)CLOVIS
07/20/2021, 12:15 PMbinaries.executable()
.Dmitry Romanov [JB]
07/20/2021, 4:46 PMPitel
07/21/2021, 9:20 AMRobert Jaros
07/21/2021, 5:46 PMdelay()
) after webpack hot reload. It seems to be new issue with Kotlin JS/IR 1.5.2x or coroutines 1.5.1.Slackbot
07/22/2021, 1:46 AMaerialist
07/22/2021, 5:52 PMPitel
07/23/2021, 8:10 AMkotlinx.browser.window
does not have this method?Pitel
07/23/2021, 1:08 PMlouiscad
07/23/2021, 3:04 PMSyntaxError: Invalid regular expression: /\[(?<text>.+)\]\((?<url>[^) ]+)(?: \"(?<title>.+)\")?\)/: Invalid escape
at new RegExp (<anonymous>)
Here's the source code that works in the JVM and fails in Chrome :
//language=RegExp
val linksRegex = """\[(?<text>.+)\]\((?<url>[^) ]+)(?: \"(?<title>.+)\")?\)""".toRegex()
When I look at the generated JavaScript code, here's what I get:
var tmp0_toRegex_0 = '\\[(?<text>.+)\\]\\((?<url>[^) ]+)(?: \\"(?<title>.+)\\")?\\)';
I tried to workaround using js("…")
:
val linksRegex = js("""'\[(?<text>.+)]\((?<url>[^) ]+)(?: "(?<title>.+)")?\)'""").unsafeCast<String>().toRegex()
Unfortunately, it then seems to strip the backslashes away as it's matching quite random strings that are not markdown-style links at all but plain English sentences.
Is there a way to get that Regex to work in JS like it does in the JVM?bsimmons
07/24/2021, 6:01 PMDavid Smith
07/26/2021, 4:35 PMEvent
to the jvm backend. In javascript I might normally do something like JSON.parse(stringifyEvent(event))
where stringifyEvent
is a function described in https://stackoverflow.com/questions/11547672/how-to-stringify-event-object/34519193#34519193. Would I need to basically do the same solution in Kotlin or is there something a bit better, perhaps built in or a library? Alternatively is there some other method to send browser events to a jvm backend?andylamax
07/26/2021, 9:25 PMNikky
07/27/2021, 10:49 AMKotlin doesn’t currently support sharing a source set for these combinations:
- Several JS targetsdoes that mean i cannot have eg. a "common" JS target and browser + nodejs + cordova depend on that ? i really hoped i could use expect/actual to modularize and commonize stuff
Nikolai Sviridov
07/30/2021, 4:59 PMhtml to react
, but at the moment I'm not succeseed in writing wrappers around them.benkuly
07/31/2021, 7:06 PMbenkuly
08/01/2021, 12:05 PMbenkuly
08/01/2021, 12:05 PMturansky
08/01/2021, 2:12 PMCLOVIS
08/01/2021, 2:31 PMbenkuly
08/01/2021, 3:17 PMCLOVIS
08/01/2021, 5:13 PMbenkuly
08/02/2021, 6:24 AMvar Account_1 = $module$_matrix_org_olm.Account;
right after the external js module is loaded. Account_1
is used later, but points to undefined, because init
wasn't called before var Account_1 = ...
. A workaround is to call js("new Olm.Account()")
everytime I would call Account()
, but that feels really bad.-Xir-property-lazy-initialization
and it did not work. Still var Account_1 = $module$_matrix_org_olm.Account;
at the beginning.