title: What does JQuery $(document).trigger(self.MY_FUNCTION) do?
body: <p>I found the following code in a JavaScript object: </p>
  
  <pre><code>;(function(App, $, undefined){
  
      if (typeof App == 'undefined') window.App = {};
  
  
      App.SomeObject = { 
  
           MY_FUNCTION: 'myfunction',
  
           myfunction: function(element) {
                  var self = App.SomeObject;
                  if (element.getSize() &lt; 1) {
                     // case 1
                  } else {
                         // case 2
                  }
  
          },
  
          secondFunction: function() {
              var self = App.SomeObject;
              $(document).trigger(self.MY_FUNCTION);
          }
  
      }
  
  })(App, jQuery);
  </code></pre>
  
  <p>In secondFunction I call</p>
  
  <pre><code>$(document).trigger(self.MY_FUNCTION);
  </code></pre>
  
  <p><strong>What is this line actually doing?</strong></p>
  
  <p><strong>When I call $(document).trigger(self.MY_FUNCTION); from another function which arguments is myfunction called with?</strong></p>
  
  <p><strong>Edit:</strong> I copied this example from some other code but I did not get the meaning. I also see the following at some other part of the code:</p>
  
  <pre><code>myfunction(someElement);
  $(document).trigger(self.MY_FUNCTION);
  </code></pre>
  
  <p>I do not get what it means.</p>
  
  <p><strong>Edit:</strong> From the JQuery <a href="http://api.jquery.com/trigger/" rel="nofollow">trigger documentation</a> I know that trigger will call the member function myfunction of SomeObject, but I do not know which parameters are being used. From my understanding the method will not work without any parameter because if (element.getSize() &lt; 1) will give an error.     </p>