async

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2019 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package async provides an async task struct to allow the UI to run background tasks.

Index

Constants

This section is empty.

Variables

View Source
var ErrCanceled = errors.New("async operation canceled")

ErrCanceled is the error set when an async operation was canceled.

Functions

This section is empty.

Types

type Async

type Async struct {
	// Cancel is used to signal cancelation to the task.
	Cancel chan interface{}

	// Done is used to signal completion to the UI.
	Done chan interface{}

	// ToUI is used to pass data from the task.
	ToUI chan interface{}

	// Err is the final completion status.
	Err error

	// UpdateProgress is the function called to give progress feedback to
	// the UI.
	UpdateProgress func(string)
}

Async is the structure containing the bits needed to communicate from a long running async task back to the UI (eg: Installation).

func NewAsync

func NewAsync() *Async

NewAsync creates a new Async structure.

func (*Async) Grab

func (async *Async) Grab(client *grab.Client, url string, hzFn func(string)) []byte

Grab asynchronously downloads the provided URL using the provided grab client, periodically invoking the hzFn on forward progress.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL