The Jolokia JavaScript Simple library provides a JavaScript Simple API to the to the Jolokia agent. Refer to Reference Manual for more details on how to use the library.
NPM:
npm i @jolokia.js/simple
Yarn:
yarn add @jolokia.js/simple
import Jolokia from "@jolokia.js/simple"
const jolokia = new Jolokia("/jolokia")
const value = await jolokia.getAttribute("java.lang:type=Memory", "HeapMemoryUsage", "used")
console.log("Heap Memory used:", value)