rewrite js api