Javascript library to trigger when user is about to leave window