javascript api implementation