Javascript API

Not ready to merge yet, PRing for openness/discussion. Addresses #19.