title: Add event listener of a method present in another js file
body: <p>I am accessing few methods written in another js file. So i'm accessing them like this:</p>
  
  <p><strong>file1:</strong></p>
  
  <pre><code>function minit() {
    this.addval = function(val1, val2) {
      return val1 + val2;
    }
  
    function autoexecute(d) {
      //do something here//
      //raise event//
    }
  };
  </code></pre>
  
  <p><strong>file2:</strong></p>
  
  <pre><code>var con = new minit();
  var result = con.addval(2, 3);
  
  /*
  con.autoexecute(function(d) { //Wanna do something like this
    alert(d);
  });
  */
  </code></pre>
  
  <p>Above things are working as expected, getting result..
  Now, Suppose <code>autoexecute(d)</code> method is invoking automatically after a time interval. How can i know if the method is executed ?</p>
  
  <p>So that, I want to create an event(in file2) of <code>autoexecute(d)</code>(in file1).</p>
  
  <p><strong>UPDATE:</strong>
  I hope this example will help you to understand the issue..</p>
  
  <p>company.js <em>//this is the main file which will be used as a reference in</em> ui.html</p>
  
  <pre><code>function hello(personname) { //this method will invoke automatically after 1 minute..
  
  }
  </code></pre>
  
  <p>ui.html</p>
  
  <pre><code>&lt;script src="company.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    $(document).ready(function() {
      function bye(personame) { //this method will be called automatically if hello method invoked.... personame is the argument passed from hello method//
  
        alert("comany.js -&gt; hello function is executed");
      }
    });
  &lt;/script&gt;
  </code></pre>