Move events handlers to view of 'share' function.