Work on JS bindings

This is me and @JanEggers futile attempt at getting somewhere with the #159 stuff.