Generate javascript code if it is requested

Change-Id: Ic415b713a6f9ab6e1189215c541685e550ce7f56