JavaScript flow controll module