- This package leverages JSweet (Java-to-JavaScript transpiler) to convert H2O POJO files into JavaScript
- It then uses browserify to bundle the JavaScript code into bundle code that can run in any web browser
Make sure you have maven, node, and browserify (which requires npm) installed in order to run the bash commands:
> sudo apt install maven
> sudo apt install nodejs
> npm install --global browserify
To use this package, git clone this directory and follow these instructions:
> git clone https://github.com/ML4LHS/Evaporate.git
- Move your H2O POJO into this directory. (If you're just trying it out, use the one already in this directory: gbm_pojo_test.java)
- Run evaporate.sh in your command line with your POJO as its argument:
> ./evaporate.sh gbm_pojo_test.java
- There should now be a JavaScript file with the same name as your pojo (i.e. gbm_pojo_test.js)
- Next, run brow.sh command to generate the JavaScript and HTML file:
> ./brow.sh gbm_pojo_test.js
- There should now be a new folder in this directory: browser/. There should see 3 files there: index.html, main.js, bundle.js
- Open index.html. You should now be able to generate H2O responses by entering in the corresponding variables
- Feel free to modify any of the files to tailor to your needs! Evaporate is not meant to be the final solution; it is simply the starting point to get you to be able to display and run your H2O code in the browser. Have fun coding!
The JSweet transpiler provides many more options to customize the way your files are transpiled. The customizations lives in the pom.xml. For a list of all the options, visit:
http://www.jsweet.org/getting-started/#Most_common_transpiler_options
- bundle: in the pom.xml you can set the <bundle></bundle> option to True or False. The bundle option just means if you want to keep all your files seperated or together. Evaporte supports both.