GWTII-150: javascript impl and example

GWTII-152: implement javascript api (initial implementation, not fully
checked yet)