websrc

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 4 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 websrc holds the scripts a page's realm runs: the realm's helpers and the sources of the runtime's programs. A release's page loads them as files of its own (Script and Bundle write them), so a Content-Security-Policy needs no 'unsafe-eval'; every other build compiles the same sources itself (docs/architecture/tsx.md).

Index

Constants

View Source
const (
	// ProgramsGlobal is the global object a runtime file registers the
	// realm's programs on, by name.
	ProgramsGlobal = "__nsgoPrograms"
	// ScriptsGlobal is the global object an app's files register its
	// scripts on, by name: its bundles and their chunks.
	ScriptsGlobal = "__nsgoScripts"
)

Variables

View Source
var (
	// Helper makes the realm's helpers, which its JavaScript reaches Go
	// through: the dispatch, release and throw of the engine's calls.
	Helper = Source{"helpers", helperJS}
	// Time patches Date to read the app's clock.
	Time = Source{"time.js", timeJS}
	// Web is the web APIs, as globals.
	Web = Source{"web.js", webJS}
	// Split and Merge are the component calls' props helpers.
	Split = Source{"split.js", splitJS}
	Merge = Source{"merge.js", mergeJS}
	// Harden is a sandbox's: it closes what makes code from strings.
	Harden = Source{"harden.js", hardenJS}
)

Functions

func Bundle

func Bundle(name, source string) string

Bundle returns the file that ships an app's script, a compiled bundle or one of its chunks, under name: the runtime runs it as it ran the script's source.

func Runtime

func Runtime() string

Runtime returns the file a page loads into the app's realm before the app starts.

Types

type Source

type Source struct {
	// Name is what the runtime looks the program up by.
	Name string
	// Source is the script.
	Source string
}

A Source is a script as the runtime runs it: an expression, which the runtime calls for the program (RunProgram).

func Sources

func Sources() []Source

Sources returns what a page ships for a TSX app's realm.

Jump to

Keyboard shortcuts

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