implement JS api