Accessing Java class / object attributes in CheerpJ based PWA

I'm new to CheerpJ and I am working on creating a React Native module for ImageJ.js (CheerpJ translated version of Java based ImageJ aka ImJoy that runs in a progressive webapp (PWA)). I am running into an issue where attributes of Java objects on the JS side seem to have an integer after the attribute names (as shown in the image for this post). Upon further investigation I noticed a pattern where this integer seems to be the index of the attribute (eg. if a class 'Dog' has attributes 'height' and 'weight' defined in that order, they appear as height0, and weight1 in the JS console). Has anyone here seen any similar issue? Not sure if I am using CheerpJ correctly. Any help would be appreciated.
No description
DarkForce8
DarkForce867d ago
Steps to reproduce issue: 1. Head over to https://ij.imjoy.io/?run=https://gist.githubusercontent.com/sspathak/902c5d7d1e8de08c7232f790cb5511b6/raw/3f498140a3cd83ce3e88b34c00582ca77e3b0b72/gistfile1.txt 2. Inspect element and go to console. 3. Run let get_image = await cjResolveCall("ij.WindowManager", "getCurrentImage"); 4. Run let im = await get_image() 5. Run Object.getOwnPropertyNames(im) You'll see that the property names have an integer suffix. This integer suffix seems to follow the order in which the instance variables are defined at https://imagej.net/ij/source/ij/ImagePlus.java
ImageJ.JS
ImageJ.JS is an open source image processing web application designed for scientific multidimensional images
apignotti
apignotti66d ago
This is all expected as part of the CheerpJ 2.x version that ImJoy is currently build on Fields used that encoding and were never really intended to be manually accessed via JavaScript
apignotti
apignotti66d ago
CheerpJ 3 offer a new clean solution called "library mode" https://labs.leaningtech.com/cheerpj3/guides/library-mode
Leaning Technologies Developer
Library mode - CheerpJ Documentation
Use Java libraries in JavaScript
DarkForce8
DarkForce866d ago
Thanks so much for the help. I just checked out the library mode and it’s exactly what I need. I’ll try to request imjoy team to upgrade. Based on your experience would upgrading imjoy to CJ3 be challenging?
apignotti
apignotti66d ago
They have already extensively tested the new version, so I don't know why they did not update: https://aicell.io/post/improving-imagej.js/
AICell Lab
Taking ImageJ.JS to the Next Level | AICell Lab
ImageJ, a renowned open-source image processing tool, has long been a familiar name in the scientific community. Seeking to build upon its rich legacy, we undertook an ambitious endeavor: to transition ImageJ to the web through ImageJ.
apignotti
apignotti66d ago
This report is very positive
DarkForce8
DarkForce866d ago
Thanks for the lead
Want results from more Discord servers?
Add your server
More Posts
Int ConversionThere is a function in Java, that calls a native function with string argument, like `setContentViewState of the C++ modules supportWhen the new C++ modules are expected to be supported?Cheerpj hangs after "Jar is loaded,main is starting"I am trying to use cheerpj to run my Java Swing app in a browser. I can run the example SwingSet3.jaStretch to Fit Height IssueRunning a basic application in the example html provided on the CheerpJ website. My html code is efProblems with CheerpjHello, I am trying to get my Java app running in CheerPJ - I was successful in creating a simple "HeCache Results for Faster Startup?Hello new user here. Performing initial research into potential commercial application usage. 1) AmUnknownHostException happened when the Java application connect to serverUnknownHostException happened when the Java application connect to server. The host name is the sameHTTP server returned compressed partial data. That should not happen. CheerpJ cannot run.Browser shows error "HTTP server returned compressed partial data. That should not happen. CheerpJ cAccesing the standard out and standard error stream from the Java processHow do I from javascript access the output streams from the started Java process?Any plan on adding internet access without Tailscale?Hi there ! Do you plan on adding internet access without the need to install Tailscale etc, that wour[((0 + c) | 0)] is not a function when instantiating objectHello, thank you all for developing CheerpJ, it is an impressive tool! I am playing around with tryiI'm always looking for the URL of the latest build of cj3loader.js by searching articlesI'm always looking for the URL of the latest build of cj3loader.js by searching articles, but is theDifferent behavior between extension and cj3loaderWe have a java applet that runs perfectly when using the CheerpJ browser extension, but fails to fulCan I try CheerpX?I know it's not fully ready yet, but I think it's fine for my use cases in its current staterunning java decompiler in browser, weird error(copy-pasting from #cheerpj3 since i noticed this channel existed) i'm trying to run the procyon javAccessibility of Java applicationsHi team, I noticed that apps running on CheerpJ are not accessible to people with disabilities. Thisjnlp launch verification fails with 64 bit swt librariesThe launch has below error. Java.lang.unsatisfiesLinkError: cannot load 64-bit SWT libraries on 32-bhow to debug why the jar main class is not loadingI am trying to convert old jnlp client to html format. I followed the documentation and used cheerpj