Adding listeners to the client-side script