Note all the code handling InChI strings and molecules was written in Java. (In fact, it was all developed and tested first in Java before implementing it here in JavaScript.) The only thing JavaScript was written for here was for laying out the page and accessing the C functions of the inchi code and the Java methods of OCL and the CDK. All the code that generates stereochemically correct 2D models and PNG images from InChI, AuxInfo, or MOL file input, and allows the user to draw a compound or drop a MOL, CDX, or CDXML file into the drawing area, was written in Java. Essentially none of the code written for these pages was written for Java-only or JavaScript-only application.
This page demonstrates how Java "native C" calls can be automatically converted to JavaScript calls to WebAssembly ("WASM"). Java uses these native calls to communicate with architecture-specific C code via a Java Native Access (JNA) interface. What we have done is to harmonize the WASM and JNA calls so that Java and JavaScript can both make identical calls to the InChI Extended Application Programming Interface (aka InChI Extended API or just IXA). So this is a bit of a hybrid application now. We use C and Java to create all of the functionality. The Java is transpiled to JavaScript by the java2script Eclipse plugin; The C code is compiled into WebAssembly by the Emscripten emcc compiler. Everything written in Java is actually running in JavaScript within your browser.
This page is the first web page that uses both OCL and the CDK as collaborative components. It is the first implementation of the CDK in JavaScript, and the first page to implement OCL in JavaScript without using additional specialized code such as the Google Web Toolkit. This is also the first program that demonstrates how OCL and the CDK can communcate with each other directly, using the JNA-InChI interface not for creating InChI, but instead for a common molecular structure interface. In Java or in JavaScript. OCL is used as a method of generating the InchiInput structures needed by InChI C. The CDK is primarily used for creating structure diagrams in PNG format from InChI. In both Java and JavaScript, both OCL and the CDK interact with the InChI Extended API via the same Java/WASM interface, InchiLibrary.java.