adding event when js script starts running