title: How to return a value from functon when an event is fired?
body: <p>I'm a complete beginner, I have a function 'func' that extract values from sql server, I want to return a promise containing these values when the request complete event is fired, not sure how to accomplish this.
  Thank you.</p>
  <pre><code>function func() {
  
      const request = new Request('SQL_Procedure');
      request.on('row', (columns) =&gt; {
          nums.push(columns[3].value);
      })
  
      request.on('requestCompleted', () =&gt; {
          return new Promise((resolve) =&gt; { resolve(nums) })//I want to return nums to the code calling the func() main function.
      });
  }
  </code></pre>