package
0.0.0-20180612134603-5a689ece0d3e
Repository: https://github.com/mjkwoolnough/gopherjs.git
Documentation: pkg.go.dev

# README

progress

-- import "github.com/MJKWoolnough/gopherjs/progress"

Package progress creates a simple progress bar in javascript

Usage

type Bar

type Bar struct {
	*dom.HTMLCanvasElement
}

Bar is a wrapper around a Canvas element to draw a simple progress bar.

It also implements dom.Node, so it can be Appended to any other node.

func New

func New(fore, back color.Color, width, height int) *Bar

New returns a new Bar

func (*Bar) Percent

func (b *Bar) Percent(i int)

Percent sets the current percentage shown

func (*Bar) Reader

func (b *Bar) Reader(r io.Reader, size int) *Reader

Reader returns a Reader type

type Reader

type Reader struct {
	*Bar
	io.Reader
}

Reader wraps a ProgressBar to automatically update when an io.Reader is read

func (*Reader) Len

func (r *Reader) Len() int

Len returns the total length of the data

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

Read implements io.Reader

# Functions

New returns a new Bar.

# Structs

Bar is a wrapper around a Canvas element to draw a simple progress bar.
Reader wraps a ProgressBar to automatically update when an io.Reader is read.