WIP Javascript API stuff (mushy)