JS implementation of java interface