1.1.2 • Published 1 year ago

fetch-abort-controller v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago
// example.js
import WebController from 'fetch-abort-controller';
const controllerId = 'controllerId'
const controllerInstance = WebController.getInstance(); 
const controller = controllerInstance.createController(controllerId);
setTimeout(() => {
    controllerInstance.abort(controllerId)
}, 500)
fetch('http://localhost:3000/api/test', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    signal: controller.signal
})
.then(response => {
    if (!response.ok) {
        throw new Error('Network response was not ok');
    }
    return response.json();
})
.then(data => {
    console.log('Data received:', data);
}).catch(e => {
    console.error('There has been a problem with your fetch operation:', e);
}) 
1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago