title: How to cancel pending promise calls inside callback function?
body: <pre><code>fetch(
    &quot;https://rqyhfmwv4b.execute-api.us-east-1.amazonaws.com/production/join-meeting&quot;,
    requestOptions
  ).then((response) =&gt; response.json())
  .then(async (data) =&gt; {
    // You need responses from server-side Chime API. See below for details.
    const meetingResponse =
    data.result
    .meetingResponsee; /* The response from the CreateMeeting API action */
    const attendeeResponse =
    data.result
    .attendeeResponsee; /* The response from the CreateAttendee or BatchCreateAttendee API action */
    const configuration = new MeetingSessionConfiguration(
      meetingResponse,
      attendeeResponse
    );
    
    // In the usage examples below, you will use this meetingSession object.
    const meetingSession = new DefaultMeetingSession(
      configuration,
      logger,
      deviceController
    );
    
    const meetingReadinessChecker = new DefaultMeetingReadinessChecker(
      logger,
      meetingSession
    );
    
    // testing
    
    if (pauseReadinessTest) {
      setPauseReadinessTest(false);
      return;
    }
    
    if (testParam == &quot;All&quot; &amp;&amp; disableStartRedinessTest !== true) {
      await audioTest(deviceController);
      setMeetingTestProgress(15);
      await micTest(meetingSession, meetingReadinessChecker, CheckAudioInputFeedback);
      setMeetingTestProgress(25);
      await videoTest(meetingSession, meetingReadinessChecker, CheckVideoInputFeedback);
      await cameraTest(meetingSession, meetingReadinessChecker, CheckCameraResolutionFeedback);
      setMeetingTestProgress(50);
      await networkTest(meetingReadinessChecker, CheckNetworkTCPConnectivityFeedback, CheckNetworkUDPConnectivityFeedback);
      setMeetingTestProgress(75);
      await streamTest(meetingSession, meetingReadinessChecker, CheckAudioConnectivityFeedback, CheckVideoConnectivityFeedback);
      setMeetingTestProgress(85);
      await screenShareTest(meetingSession, meetingReadinessChecker, CheckContentShareConnectivityFeedback);
      setMeetingTestProgress(100);
      setRefreshIconClass(&quot; &quot;);
      SetDisableStartRedinessTest(false);
      setIsResult(&quot;result&quot;);
  }
  </code></pre>
  <p>I have this block of code and I want to cancel the pending await function calls if at any point in time the user wants to exit from the test. But the issue is whenever the value of a variable gets updated it doesn't reflect inside the block which is causing the main issue over here.</p>