Skip to content
This repository has been archived by the owner on Feb 27, 2022. It is now read-only.

Stop/Cancel Callback #115

Open
3 tasks done
Timo-Linde opened this issue Jul 30, 2021 · 0 comments
Open
3 tasks done

Stop/Cancel Callback #115

Timo-Linde opened this issue Jul 30, 2021 · 0 comments

Comments

@Timo-Linde
Copy link

Is this a bug report, a feature request, or a question?

Feature Request

Have you followed the required steps before opening a bug report?

(Check the step you've followed - put an x character between the square brackets ([]).)

Description

You instantiate a Download like this:

import RNBackgroundDownloader from 'react-native-background-downloader';

let task = RNBackgroundDownloader.download({
	id: 'file123',
	url: 'https://link-to-very.large/file.zip'
	destination: `${RNBackgroundDownloader.directories.documents}/file.zip`
}).begin((expectedBytes) => {
	console.log(`Going to download ${expectedBytes} bytes!`);
}).progress((percent) => {
	console.log(`Downloaded: ${percent * 100}%`);
}).done(() => {
	console.log('Download is done!');
}).error((error) => {
	console.log('Download canceled due to error: ', error);
});

// Pause the task
task.pause();

// Resume after pause
task.resume();

// Cancel the task
task.stop();

Lets assume you want to wrap the Download Process in a Promise and you want to resolve and reject the promises with the available callbacks. It its possible, but when you want to stop, pause or resume the task there is no callback for this.
So you cant resolve or reject a promise if you stop the task.

So my Feature Request is: Can you add at least a Callback for stop and prefeably for pause and resume too?

Expected Behavior

Callbacks for every status change on a task.

Actual Behavior

No Callbacks for stop, pause and resume

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant