title: Explanation request about a promise in a vuejs sample
body: <p>I have a little sandbox <a href="https://codesandbox.io/s/modal-send-answer-to-parent-obufc" rel="nofollow noreferrer">here</a> with two components. A list of objects ("Groups" for the example) and a confirmation modal. The modal is triggered when a delete button is clicked. (This sandbox is extracted from <a href="https://stackoverflow.com/questions/60543930/how-to-send-modal-result-in-parent-component">another post</a> in which I asked for different ways to send the result of the modal to the parent component, the <code>GroupList</code>).</p>
  
  <p>Here's the modal component:</p>
  
  <pre><code>&lt;template&gt;
    &lt;b-modal
      id="modalConfirmation"
      title="Confirmation"
      ok-variant="danger"
      @cancel="resolvePromise(false)"
      @ok="resolvePromise(true)"
      @close="resolvePromise(false)"
    &gt;Are you sure you want to delete this row ?&lt;/b-modal&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
    name: "ModalConfirmation",
    data() {
      return {
        group: null,
        resolvePromise: null,
        rejectPromise: null
      };
    },
    methods: {
      show(group) {
        return new Promise((resolve, reject) =&gt; {
          this.group = group;
          this.$bvModal.show("modalConfirmation");
          this.resolvePromise = resolve;
          this.rejectPromise = reject;
        });
      }
    }
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>The best solution for me was this one. However, while I understand the principle of JavaScript promises, I couldn't figure out how it works in this case. It works perfectly, but I don't like to use code that I don't understand.</p>
  
  <p>In the <code>ModalConfirmation</code>, for the <code>b-modal</code> tag, these are the event that set the result of the modal. But how does vuejs / bootstrap-vue make the matching between that and the promise ?</p>
  
  <pre><code>@ok="resolvePromise(true)"
  @cancel="resolvePromise(false)"
  @close="resolvePromise(false)"
  </code></pre>
  
  <p>Because the promise constructor is called when the modal is showed and that's all...</p>
  
  <p>Moreover, if I comment this</p>
  
  <pre><code>  resolvePromise: null,
    rejectPromise: null
  </code></pre>
  
  <p>in the modal component, it still works. Can someone explain me the flow of promise resolution in this case?</p>