miladvafaeifard / abort-controller-in-js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AbortController

The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.

You can create a new AbortController object using the AbortController() constructor. Communicating with a DOM request is done using an AbortSignal object.

Examples

const controller = new AbortController();

async function fetchVideo() {
  const response = await fetch(url, { signal });
} 

function abortDownloading() {
  controller.abort();
}

About


Languages

Language:JavaScript 71.2%Language:HTML 28.8%