Comments (6)
You are welcome :)
from kotlin-playground.
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.
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.
@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.
So I added a simple condition. Ok for u?
from kotlin-playground.
@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)
- Copy sharable link to clipboard: the button sometimes doesn't work HOT 3
- Kotlin coroutines possible bug with `GlobalScope.launch` HOT 1
- [Bug] Online playground is not working when use `Executors.newSingleThreadExecutor().asCoroutineDispatcher()` as CorotuineDisaptcher
- no way to pass compiler options? HOT 1
- Full source for play.kotlinlang.org available? HOT 4
- JS IR compiler cannot find dependency HOT 1
- ability to use arguments that contain spaces HOT 1
- The code doesn't compile
- cannot create a `hashMap` from a `List<Pair<String, String>>` by using `hashMapOf` HOT 5
- Following a link to playground breaks browser back button
- Editor & console flickering
- remainder operator two is not zero student grades algorithm
- How to pass command line arguments dynamically HOT 1
- Code is automatically indented with spaces, but tabs are still inserted when I use the `Tab` key
- No main method found in project. HOT 1
- Adjustable height of console window for small size screens HOT 1
- tst
- How to change code from JS HOT 1
- Unexpected println output HOT 2
- Kotlin 2.0.0-Beta 2 on Kotlin Playground HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin-playground.