Hi, i just wondered how we can make a web component to run Nim code inside a web page. For example, for Kotlin language there is an npm package: "kotlin-runcode - npm" https://www.npmjs.com/package/kotlin-runcode
How can we can do the same thing with Nim?
And Kotlin's official playground also provide a way to embed and run ur code in web like that. Is it possible with Nim language too, and without CORS?
Please help me, u know, i wanted to create some more tutorials on Nim(on Sololearn and Dev community) but i really want this first, im actually facing lot issues with Nim official code playground, which i've told in my previous thread, still some problems r not resolved yet.
Note: im not comparing Kotlin and Nim anywhere here.
It looks like runcode is just sending kotlin code to a server that compiles it, more or less the same as nim playground, so you can do that too, eg here is how the frontend for the playground does it: https://github.com/PMunch/nim-playground-frontend/blob/master/frontend.nim#L111 you just need to write your own GUI.
For tutorials, you can also just precompile the code to js and embed it in the html. If you put it in a function and then call that function in the onClick of a button it should have the same effect you want. Of course you can't have that in an editable tutorial unless you find a way to get the code compiled in some way.