updated js to expose a global var