0.0.13 • Published 10 months ago

mharj-http-client v0.0.13

Weekly downloads
4
License
LGPL-2.1-or-later
Repository
github
Last release
10 months ago

mharj-http-client

// initialize http client with 200ms delay on loading state change if progress is not supported (defaults 100ms)
const {fetch, onLoading} = HttpClient.getInstance({delay: 200});
onLoading((state) => {
	// do something for state boolean i.e. update redux state
});
onProgress((progress) => {
	// do something with download progress data {start: Date, received: number, size: number}
});
export default fetch;

with logger (console, log4js)

// initialize http client
const {fetch} = HttpClient.getInstance({logger: console});
export default fetch;

track stream process if supported as async (can be run with just callback without await, but it's good then to .catch())

const res = await fetch('https://google.com');
/* const wasTracked = */ await trackStreamProcess(res, (data) => console.log(data));
const data = await res.text();
0.0.12

10 months ago

0.0.13

10 months ago

0.0.11

1 year ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

4 years ago