changed js samples to promise impl