@operationspark.org/fetch-cb
v1.0.2
Published
This is a simple wrapper around the `fetch` API that allows you to provide a callback function to be called when the fetch is complete instead of a promise.
Readme
@operationspark.org/fetch-cb
This is a simple wrapper around the fetch API that allows you to provide a callback function to be called when the fetch is complete instead of a promise. This package was created for educational purposes and is not intended for production use.
Installation
npm install @operationspark.org/fetch-cbUsage
import fetchCallback from '@operationspark.org/fetch-cb';
fetchCallback(
'https://jsonplaceholder.typicode.com/todos/1',
(error, response) => {
console.log(response.json());
// { userId: 1, id: 1, title: 'delectus aut autem', completed: false }
console.log(response.text());
// '{"userId":1,"id":1,"title":"delectus aut autem","completed":false}'
}
);