NXP-13989: fix refresh and refactor jsFunction