Replies: 4 comments 6 replies
-
in my opinion we should make the code between HTML5 javascript and graalVM javascript as reusable as possible and maintaining 2 different APIs seems like a lot of development work that we could use in other areas ,so we should do either 2 or 3. |
Beta Was this translation helpful? Give feedback.
-
Yep, number 2 is the way to go. While it's a bit more work creating Promise-based APIs initially, it'll shield user code from future changes better. |
Beta Was this translation helpful? Give feedback.
-
Rather than a REST API, we could enable As for promises in GraalVM... I'm unconvinced that it will help as much as it will hurt. The Java implementation side is easy enough: just wrap all returns in a First, it masks the fundamental differences between GraalVM javascript and HTML5 javascript. In the first case, the promise always returns immediately fulfilled, so users can just skip waiting on the promise, and won't get bit by that. In the second case, promises won't be immediately fulfilled. So code may not be 100% portable. Second, it complicates using the javascript API. Instead of function foo(token) {
token.setName("bar");
token.setNotes("baz");
} it's function foo(token) {
token.setName("bar").then(()=>{
token.setNotes("baz");
});
} or, slightly better async function foo(token) {
await token.setName("bar")
await token.setNotes("baz")
} And then awaiting each call to I think this becomes largely a non-problem if we consider the roles of GraalVM and HTML5 properly. HTML5 javascript is frontend, like the javascript running on a web page (because that is what it is). GraalVM javascript serves the same purpose as nodejs. Want to give the player a fancy UI? Use HTML5js. Want to make a bunch of changes to tokens or maps? Use GraalVMjs. It is good for the HTML5 javascript to be able to read and write to tokens and so on, just as it is good that GraalVMjs can create and send data to HTML5 contexts. But I don't think either one should be artifically gimped to match the intrinsic limitations of the other. |
Beta Was this translation helpful? Give feedback.
-
we were discussing #3416 and we reached a conclusion that the js api shouldn't be a one to one reimplementation of the current macro functions as it could hinder future changes. but as it stands now the js api is still too incomplete so it was suggested a temporary "legacy" new javascript api which would contain most of the more used functions but wouldn't receive new features while the new js api is worked on, i think it would be useful to create a list of features the new api should have and which the legacy javascript api should include if any. |
Beta Was this translation helpful? Give feedback.
-
If we are going to start supporting JavaScript as a scripting language properly going forwards then we are going to need to come up with a (at lest half decently) thought out API.
One of the issues that we have is the JavaScript that runs in HTML5/Dialog5/Overlay runs in the JavaFX thread which leads to two problems
While on the surface option 4 seems kinda crazy it does have a certain appeal as it resembles a web development model...
Once we have figured out how to approach it we can start detailing what is needed.
Beta Was this translation helpful? Give feedback.
All reactions