Convert emval.js to a JS library.

This is for review at the moment. I'm finishing up the conversion of embind.js (which is significantly larger).

Please let me know if there's any issue with this.

The two embind tests in the emscripten tree pass with this and I've confirmed by looking at the generated JS that is looks to be as good as the old style to the best of my knowledge.

cc: @chadaustin