add leave event and listen leave event