tinytime

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 2 Imported by: 0

README

tinytime

TinyGo-compatible time package for Go, using syscall/js on WASM to keep binaries small and leverage native JS time APIs.

Minimal and portable time utility package for Go and TinyGo with WebAssembly support. When compiled for wasm (GOOS=js GOARCH=wasm), it uses syscall/js to access native JavaScript time APIs (Date.now, performance.now, etc.), drastically reducing binary size by avoiding the Go standard library. For non-WASM targets, it falls back to the standard time package. Ideal for frontend projects where binary size and compatibility with JavaScript environments matter.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimeProvider

type TimeProvider interface {
	UnixNano() int64
	UnixSecondsToDate(int64) string
	UnixNanoToTime(any) string
}

TimeProvider define la interfaz para utilidades de tiempo implementada tanto para Go estándar como para WASM/JS.

func NewTimeProvider

func NewTimeProvider() TimeProvider

NewTimeProvider retorna la implementación correcta según el entorno de compilación.

Jump to

Keyboard shortcuts

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