widgetelement

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 8 Imported by: 0 modules, 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 widgetelement writes the element file of a widget (REQ-ISL-19): the small loader that a host page loads. `gx wc build`, the dev host page and the app, which serves it at /_gx/widgets/<tag>.js, use it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassName

func ClassName(tag string) string

ClassName makes the class name of a tag: "acme-cart" gives "AcmeCart". The element file exports its class as this name and "Element".

func File

func File(c Config) ([]byte, error)

File returns the element file of one widget.

Types

type Config

type Config struct {
	// Tag is the element name, for example "acme-cart".
	Tag string `json:"tag"`
	// Attrs are the attributes that the element sends to the server.
	Attrs []string `json:"attrs"`
	// Server is the origin of the Gx server, for example
	// "https://api.acme.dev". Empty means the origin of the host page.
	Server string `json:"server"`
	// Path is the path of the GET route of the widget.
	Path string `json:"path"`
	// Self marks a file that the Gx server serves: the origin of the
	// server is then the origin of the URL of the file.
	Self bool `json:"self,omitempty"`
}

Config is the configuration of one element file.

Jump to

Keyboard shortcuts

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