at

package module
v0.0.0-...-20ff9f8 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

README

At

The simple library that execute func in the future at a predefined time.

Install

go get -u github.com/RyuaNerin/at

Usage

GoDoc - github.com/RyuaNerin/at

job := After(2 * time.Second, func() {
    fmt.Println("Hello World!")
})

job.Cancel()

job.Wait(0)

LICENSE

GNU GENERAL PUBLIC LICENSE v3

Documentation

Overview

The simple library that execute func in the future at a predefined time.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CancelAllJobs

func CancelAllJobs()

Cancel all jobs

Types

type Action

type Action func()

type Job

type Job struct {
	// contains filtered or unexported fields
}

func After

func After(d time.Duration, action Action) (job *Job)

Execute action after a given time.Duration

func At

func At(t time.Time, action Action) (job *Job)

Execute action after a given time.Time

func (*Job) Cancel

func (job *Job) Cancel()

Cancel job.

func (*Job) IsWorked

func (job *Job) IsWorked() bool

If job is executed and not canceled, returned true.

func (*Job) Wait

func (job *Job) Wait(d time.Duration) bool

Wait job for a given time.Duration. If job is executed within time, returned true. If d is 0, waited for the job to execute.

Jump to

Keyboard shortcuts

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