evmruntime

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: 0BSD Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package evmruntime supplies types shared by the Go host and guest code. Use Ambient to pass inherited values to nested GoX components.

Index

Examples

Constants

This section is empty.

Variables

View Source
var BindingSource embed.FS

Functions

This section is empty.

Types

type Ambient

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

Ambient is an immutable stack of inherited values. Values themselves are not copied. A nil pointer is empty. CloneWith snapshots the supplied delta map.

func (*Ambient) CloneWith

func (a *Ambient) CloneWith(values map[string]any) *Ambient

CloneWith overlays values on the receiver. It copies the map entries and shares the parent. An empty map returns the receiver.

Example
package main

import (
	"fmt"

	"github.com/andreyvit/evm/evmruntime"
)

func main() {
	var empty *evmruntime.Ambient
	page := empty.CloneWith(map[string]any{"theme": "light", "lang": "en"})
	panel := page.CloneWith(map[string]any{"theme": "dark"})
	fmt.Println(page.Get("theme"), panel.Get("theme"), panel.Get("lang"))
}
Output:
light dark en

func (*Ambient) Get

func (a *Ambient) Get(key string) any

Get looks up the nearest binding for key and returns nil if none exists.

func (*Ambient) Values

func (a *Ambient) Values() map[string]any

Values returns an independent map, for bridges to APIs that accept extras.

Directories

Path Synopsis
Package concurrency provides state that parallel callbacks can safely share.
Package concurrency provides state that parallel callbacks can safely share.
Package log sends guest output to the logging context supplied by the host.
Package log sends guest output to the logging context supplied by the host.

Jump to

Keyboard shortcuts

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