title: Trying to understand promise based javascript code
body: <p>I have the following promise code in a <a href="https://github.com/awslabs/aws-mobile-react-native-starter/blob/master/client/lib/Categories/Auth/Components/Examples/SignIn.js" rel="nofollow noreferrer">existing open source library</a>:</p>
  
  <p>simplified code is following:</p>
  
  <pre><code>class SignIn extends React.Component {
    constructor(props) {
      super(props);
      // What is the underlying type of this.resolver ?
      this.resolver = Promise.resolve();
    }
  
    handleMFACancel() {
      // Is resolver a function ?
      this.resolver(null);
    }
    handleMFASuccess(session) {
      // Is resolver a function ?
      this.resolver(session);
  
    }
  }
  </code></pre>
  
  <p>I do not understand how we could use <code>this.resolver</code> as a function.</p>
  
  <p>It is not supposed to be a resolved promise or maybe simply a promise.</p>