timer

package
v0.16.14 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package timer provides setTimeout, setInterval, Sleep and Ticker helpers for wings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetInterval

func SetInterval(fn func(), interval int) (cancel func())

SetInterval schedules fn to run every interval milliseconds. Returns a cancel() function that stops the interval.

func SetTimeout

func SetTimeout(fn func(), delay int) <-chan struct{}

SetTimeout schedules fn to run after delay milliseconds. Returns a channel that closes when fn completes.

func Sleep

func Sleep(ms int)

Sleep blocks the current goroutine for ms milliseconds, yielding control to the JavaScript event loop while waiting.

Types

type Ticker

type Ticker struct {
	Tick chan struct{}
	// contains filtered or unexported fields
}

Ticker sends on Tick at the configured interval.

func NewTicker

func NewTicker(ms int) *Ticker

NewTicker returns a Ticker that sends on Tick every ms milliseconds. Call Stop() to release resources.

func (*Ticker) Stop

func (tk *Ticker) Stop()

Stop stops the ticker and releases resources.

Jump to

Keyboard shortcuts

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