const controller = new AbortController();
const { signal } = controller;
fetch("http://localhost:8080", { signal }).then(response => {
console.log(`Request complete`);
}).catch(e => {
console.warn(`Fetch error: ${e.message}`);
});
controller.abort();
/*
run:
"Fetch error: The operation was aborted. "
*/