I have successfully installed CheerpJ on Centos 7, converted a jar file , used it to convert and run an applet that worked in the days of java (and still works in IE). I used the commands on the Getting Started page under "Converting an applet".
The returned object is always an [object Promise]. On the other hand, calls like
seem to work fine.
The applet is initialized, has been sitting for many minutes responding to other commands. Only these "get" commands fail. (Caveat: this is my first encounter with a Promise object, so ancient is my knowledge.) I did also try, out of curiosity, to look at the returned value of cheerpjInit(), not knowing if anything would be returned at all. The result was also an [object Promise].
What should I be doing?
Progress: I wasn't immediately able to get the "await" version to work, so rather than awaiting a better understanding, I tried the "Promise/then" version and got something that I can live with pretty easily. But I do have another question:
The successful return was not in the form of data; it was an Object. I stringify'd it to see that it is returning a field called "value0":
So I can get my goodies with
in this case. But whose "value0" is this? That is, who named it? Is it from CheerpJ? If so, where is this described and is it here to stay? And how do I know what other sorts of fields to expect, if any, with other such calls?
@alexp-sssup Good to know, many thanks for the speedy info. Speaking of speed, that is my other concern. The loading time is very high, at least the first time CheerpJ is encountered by each browser. If someone comes to my website to simply have a quick look at an object, many would probably leave rather than wait so long. In fact, I had to wait different amounts of time as I tested various browsers. The ones I tested eventually worked, but some seemed to require refreshing a few times. (In one case I walked away to have dinner and there was no change when I came back, but I do not recall the message being displayed at the time, sorry.) Is this a result of my using the version that requires loading from your website?
Any advice about that?
do you have jar.js for each of your jars?
Yes, just one jar compiled into one jar.js, both in the same directory.
Beside this there are several things you have to do to improve startup time, in particular set up preloading
Thanks. I have now tried preloading.
If my (few) experiments with Firefox and Edge are correct (clearing cache and reloading the cheerpjfy'd app), the initial load time today (*) has gone from around 60 seconds to about 10-15 seconds, pretty good! But...
I had already enabled Gzip compression (it was not previously enabled), but that didn't seem to help. Maybe because the jar.js file isn't so big (about half a megabyte)? In any case, today's loading time is a big improvement. But I am not sure how much the preloading (using the ouput of cjGetRuntimeResources()) is the reason, because when I switch between preloading and the default, I cannot tell a difference in the loading time. Could Leaningtech traffic play any role?
And whether I preload or not, I still get poor marks from Google's PageSpeed Insights (around 25 out of 100) in all of these cases, with a long list of deficits attributed to Leaningtech files and such.
(*) Another experiment: In a "Private Window" in Firefox, all I got was the CheerpJ "loading" image for over five minutes. I closed it. I tried that again, for over 10 minutes. Nothing. But I will not concern myself with that.
For the typical browsers, after the initial loading following a cleared cache, load time is around 3-5 seconds. I'll probably be okay with that for my purposes.