utils

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 10 Imported by: 0

README

GWC | Utils Library

GoWebComponents (GWC)

High-Level Overview

The utils library contains shared utility helpers used across runtime and tooling code paths.

Public APIs

github.com/monstercameron/GoWebComponents/utils (package utils)
  • Functions: ConsoleLog, ConsoleStructured, DisableAllDebug, DisableGoroutineMonitoring, EnableAllDebug, EnableGoroutineMonitoring, EnableHotReload, GetDebugStatus, GetGoroutineStats, GetMemStatsSampleRate, InstallHotReloadBridge, IsHotReloadEnabled, ResetGoroutineBaseline, ResolveDocumentURL, SetDebug, SetDebugNamespace, SetDebugNamespaces, SetDebugNamespacesExclusive, SetGoroutineThreshold, SetMemStatsSampleRate, WaitForever
  • Types: FastComparable
  • Variables: none
  • Constants: none

Subfiles And Purpose

  • production_mode_production_wasm_test.go - Tests for production_mode_production_wasm behavior
  • production_mode_wasm_test.go - Tests for production_mode_wasm behavior
  • README.md - Folder-level documentation
  • utils.go - Core implementation for utils
  • utils_production.go - Production-mode implementation or helpers
  • utils_production_mode.go - Production-mode implementation or helpers
  • utils_production_wasm_test.go - Tests for utils_production_wasm behavior
  • utils_wasm_test.go - Tests for utils_wasm behavior

File Map

utils/
|-- production_mode_production_wasm_test.go
|-- production_mode_wasm_test.go
|-- README.md
|-- utils.go
|-- utils_production.go
|-- utils_production_mode.go
|-- utils_production_wasm_test.go
\-- utils_wasm_test.go

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigureDebugNamespace

func ConfigureDebugNamespace(parseNamespace string, isEnabled bool)

ConfigureDebugNamespace enables or disables debug logs for a specific namespace.

func ConfigureDebugNamespaces

func ConfigureDebugNamespaces(parseNamespaces map[string]bool)

ConfigureDebugNamespaces enables multiple namespaces at once.

func ConfigureDebugNamespacesExclusive

func ConfigureDebugNamespacesExclusive(parseNamespaces map[string]bool)

ConfigureDebugNamespacesExclusive disables global debug and only enables specified namespaces.

func ConfigureGoroutineThreshold

func ConfigureGoroutineThreshold(parseThreshold int)

ConfigureGoroutineThreshold configures the threshold for goroutine leak detection.

func ConfigureMemStatsSampleRate

func ConfigureMemStatsSampleRate(parseRate int64)

ConfigureMemStatsSampleRate configures how often memory stats are collected. Higher values = less frequent collection = better performance. Lower values = more frequent collection = more detailed monitoring.

func DisableAllDebug

func DisableAllDebug()

DisableAllDebug disables all debug logging globally

func DisableDebug

func DisableDebug()

DisableDebug disables verbose debug logs at runtime.

func DisableGoroutineMonitoring

func DisableGoroutineMonitoring()

DisableGoroutineMonitoring stops goroutine leak monitoring

func EnableAllDebug

func EnableAllDebug()

EnableAllDebug enables all debug logging globally

func EnableDebug

func EnableDebug()

EnableDebug enables verbose debug logs at runtime.

func EnableGoroutineMonitoring

func EnableGoroutineMonitoring()

EnableGoroutineMonitoring starts monitoring for potential goroutine leaks This helps detect and prevent goroutine accumulation in long-running applications

func EnableHotReload deprecated

func EnableHotReload(isEnabled bool)

EnableHotReload enables or disables hot reload.

Deprecated: use hotreload.Enable / hotreload.Disable directly.

func GetDebugStatus

func GetDebugStatus() map[string]bool

GetDebugStatus returns current debug settings

func GetGoroutineStats

func GetGoroutineStats() map[string]int64

GetGoroutineStats returns current goroutine statistics

func GetMemStatsSampleRate

func GetMemStatsSampleRate() int64

GetMemStatsSampleRate returns the current memory stats sample rate

func InstallHotReloadBridge deprecated

func InstallHotReloadBridge(parseAtomIDs ...string)

InstallHotReloadBridge configures the hot reload bridge with the given atom IDs.

Deprecated: use hotreload.Configure directly.

func IsHotReloadEnabled deprecated

func IsHotReloadEnabled() bool

IsHotReloadEnabled reports whether hot reload is enabled.

Deprecated: use hotreload.Enabled.

func ResetGoroutineBaseline

func ResetGoroutineBaseline()

ResetGoroutineBaseline resets the baseline goroutine count to current count This is useful after major application state changes

func ResolveDocumentURL

func ResolveDocumentURL(parseRelative string) string

ResolveDocumentURL resolves a relative asset path against the current document URL.

func WaitForever

func WaitForever()

WaitForever blocks indefinitely so js/wasm programs stay alive for events. It delegates to interop.KeepAlive, the shared keep-alive primitive also used by ui.Run.

func WriteConsole

func WriteConsole(format string, parseArgs ...interface{})

WriteConsole wraps the browser console for easier debugging.

func WriteConsoleStructured

func WriteConsoleStructured(parseLevel, parseScope, parseMessage string, parseFields map[string]interface{})

WriteConsoleStructured writes a structured entry to the browser console when available.

Types

type FastComparable

type FastComparable interface {
	FastEqual(other interface{}) bool
}

FastComparable is an interface for types that can provide fast equality comparison

Jump to

Keyboard shortcuts

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