added anticipated JS API code

I've added some dreamcode to the README, describing the frontend JS API the way it could be. If that looks good, I'll implement it, then let's see if we can get the code generated automatically.