Add helper function to run Js on future completion