title: Message Event Handler Exist or not in window object
body: <p>I have a page in HTML that contains iframe. If message comes from iframe I have to handle it. But how to check if message event handler exist or not? My code is</p>
  
  <pre><code>$(window).on('message',function(e){
  console.log(e.originalEvent.data);
  }); 
  </code></pre>
  
  <p>When button is clicked this code set message event handler. But when again clicked - again message handler get added. Is there any method to know if in window object is message event handler present or not. Please guideline. I can't use global variable in my case. If it's possible to get event handler from window object then please explain the method.</p>