Giter Site home page Giter Site logo

Comments (6)

AlexanderPrendota avatar AlexanderPrendota commented on May 28, 2024 1

You are welcome :)

from kotlin-playground.

AlexanderPrendota avatar AlexanderPrendota commented on May 28, 2024

Hi! Thanks!
Ah I see. I have forgotten about external JS libs. So let me have a look at your solution. Thanks

from kotlin-playground.

fgutmann avatar fgutmann commented on May 28, 2024

Hi Alexander!

You are very welcome. Thanks for providing this nice tool. It makes teaching kotlin way more easy :-)

As stated in the PR, the solution is not perfect yet. In my opinion in the end it will be best to have a separate iframe for each js executable too. Basically we would just handle it the same way like canvas with data-output-height="0".

Why I think this is a good idea

Firstly it allows multiple executables to run side by side and there is no chance of interference. Especially when explaining coroutines, timeouts and so forth, longer running codes can be quite common.

Secondly for me as a user it was quite unclear what the difference between canvas and js actually is. Both are executed client-side and canvas doesn't provide any canvas specific features (e.g. no canvas is created for you). You can actually run the exact same code written for canvas in js mode. The only difference between them is that you don't see the DOM output in js mode.

Thirdly it simplifies the code. We would only have one way how iframes are handled.

Way forward

Please let me know what you think of this approach. Did I forget any important points or misunderstood the difference between js and canvas?

If you agree, I'm happy to implement the changes. It won't be much work based on the current PR.

Also I would like to implement support for async println() statements for js and canvas in the near future. Currently their output is swallowed. When we have support for this, the shortcomings of the "one iframe for multiple executables" approach will start to be more visible.

from kotlin-playground.

AlexanderPrendota avatar AlexanderPrendota commented on May 28, 2024

@fgutmann Hi! If I can not close the console. I got the

executable-fragment.js:232 Uncaught TypeError: Cannot read property 'reloadIframeScripts' of undefined
    at ExecutableFragment.onConsoleCloseButtonEnter (executable-fragment.js:232)
    at onclick.callback (EventListener.js:23)

after your changes. Could you take a look please?

from kotlin-playground.

AlexanderPrendota avatar AlexanderPrendota commented on May 28, 2024

So I added a simple condition. Ok for u?

from kotlin-playground.

fgutmann avatar fgutmann commented on May 28, 2024

@AlexanderPrendota You're totally right, I forgot to test to close the console for Java.
The condition is the proper fix. Thank you!

from kotlin-playground.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.