title: Is there a way to trigger call a method in another module that "might" exist?
body: <p>I know this is a base question... but I'll try to explain.</p>
  
  <p>I've been using a Deferred, but someone pointed out that I'm using it as an anti-pattern.
  Basically, I can use the deferred in the child module. BUT if this is an anti-pattern, what is the best way to achieve this in which the "child module" might not be there.. SO, I don't want to explicitly call the child method in the success of the parent ajax call.</p>
  
  <p>So, three questions:</p>
  
  <ol>
  <li><p>Is this a viable way, if not - what is a good way to achieve what I am going for?</p></li>
  <li><p>Even though I am resetting the Deferred, it isn't seeming to 'reset'. Why?</p></li>
  <li><p>CAN this also be achieved coupling it with another event - ie, onload. SO&lt; we have the ajax AND onload doing the same thing.</p></li>
  </ol>
  
  <p>I have a parent module.</p>
  
  <pre><code>var Z = {};
  
  Z.someVar = $.Deferred();
  
  Z.a = function(){
      //methods
  
      //Ajax call on page: can be once or multiple calls.
      $AJAX = {
          url:...,
          dataType: ...,
          //etc..
      }.success(
        function(){
           Z.someVar.resolve();
        }
      ).error();
  
  
  };
  
  // another method that MIGHT exist.
  
  Z.b = function(){
     var func1 = function(){
         // do some stuff
         Z.someVar = $.Deferred(); // reset it.
     }
     Z.someVar.done(function(){
        func1();
     })
  }
  </code></pre>