• Romain Courteaud's avatar
    Adding promise cancel · f8ce66af
    Romain Courteaud authored
    Cancel allow to manually interrupt a promise execution.
    The promise becomes rejected with a CancellationError.
    
    var xhr, promise;
    promise = RSVP.Promise(
      // Resolver function
      function (done, fail) {
        xhr = new XMLHttpRequest();
        xhr.open("GET", url);
        xhr.send();
      },
      // Canceller function
      function () {
        xhr.abort();
      },
    )
    promise.cancel();
    f8ce66af
extension_test.js 37.9 KB