https://kotlinlang.org logo
Title
d

diesieben07

01/25/2018, 9:31 AM
The answer is probably "no", but just to be sure: Is there something like Java's
ServiceLoader
for pure Kotlin, i.e. can be used in a multiplatform project?
🇳🇴 4
g

gildor

01/25/2018, 1:39 PM
No, but it should be pretty easy to write own service locator for your code
d

diesieben07

01/25/2018, 1:53 PM
Is there a pure-kotlin resource-access mechanism? Something like
Class.getResource
?
g

gildor

01/25/2018, 2:07 PM
Resources is Java specific API
d

diesieben07

01/25/2018, 2:07 PM
Yes, I know that. Question is, what would I do on the JS side?
g

gildor

01/25/2018, 2:08 PM
Depends on your use case. There is no default js way to do that
d

diesieben07

01/25/2018, 2:08 PM
Ok, that was my question, thanks.
g

gildor

01/25/2018, 2:09 PM
Also js can be client and server side with different API set in each case
d

diesieben07

01/25/2018, 2:10 PM
Yeah, I know. I was hoping Kotlin would provide something here to embed resources into final build artifact (.js file).
g

gildor

01/25/2018, 2:12 PM
Nope. But you can provide them using expect/actual methods and implement on each platform. Depends on resource type. Probably you want to download it on client side and bundle to resources on server side
d

diesieben07

01/25/2018, 2:12 PM
Yeah. I'll have to do some experiments. Thanks!