switch to js api