Add a method to observe DOM events