add accurate javascript event registration