I have a KotlinJS project with a main function tha...
# javascript
a
I have a KotlinJS project with a main function that starts my React.JS app. This main function loads when the .js file is loaded via script tag Is it possible to make it so that the app does not immediately initialize once the js file is loaded? I'd like to include the script tag to load the JS file and then at some time later initialize my react app on a button click But to do this I need to be able to call the KotlinJS main function (or any other function to start the app) from JavaScript manually ...
t
Copy code
@JsExport
fun start() {
    ReactDOM.render(...)
}
Also you can use
document
event as start trigger
a
awesome, you are a KotlinJS god
@JsExport does not prevent the DCE from happening for those functions needed to explicitly keep these functions in the dceTask in Gradle
t
Do you use legacy compiler?
a
yes. is the new compiler production-ready?
t
Officially - alpha, like multiplatform :) IR have more “hidden” features (especially for external types) Single blocker for me - compilation speed, but my project is really big