A library agnostic javascript function for listening when node gets inserted to DOM