Does std.net.curl: download have support for callbacks?

adnan338 relay.dev.adnan at protonmail.com
Thu Jun 11 06:05:09 UTC 2020


I would like to set a callback for the `download()` function but 
I do not seem to find a way to add a callback to the procedure.

Let's say, for example I have a GtkD Widget called "pb" (short 
for progressBar).

I want to download a file from a url and when done, I want a 
callback to access pb and increase by a certain number.

The GtkD progress bar API:
https://api.gtkd.org/gtk.ProgressBar.ProgressBar.setFraction.html

Normally, If it was dependent on a button, I would do something 
like:

     auto pb = new ProgressBar();
     auto more = new Button("go-next", GtkIconSize.BUTTON);
     more.addOnClicked(delegate void(Button _) {
         if (activityMode.getActive()) // ignore this if condition
             pb.pulse;
         else
             pb.setFraction(pb.getFraction + pb.getPulseStep);
     });

But how can I do this with `download()`?


More information about the Digitalmars-d-learn mailing list