tifa

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 9 Imported by: ? 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 tifa gives a beastjs.VM what tifa (github.com/liustack/tifa) gives each VM of its pool before it runs a bundle: URL and URLSearchParams, Intl and Temporal, and the functions named __tifa_* that the bundles tifa builds ask for.

beastjs is made for tifa, so tifa, the beastjs command and the program that measures tifa's pages (internal/measure/pages) all set a VM up with Register, and what a VM of each has is the same.

The functions named __tifa_* are those of Hooks:

The host script of a bundle takes __tifa_random_bytes__ and __tifa_async_context__ and deletes them from the global object before any code of the app runs. The others stay.

What stays in tifa: the memory limit, the call depth and the eval timeout of a VM, the checks of tifa dev and of its emit check build, the bundle and the collections between renders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hooks

func Hooks() []string

Hooks returns the names of the globals named __tifa_* that Register defines, in the order it defines them. Each is a function, but for __tifa_async_context__, an object with the functions get and set.

func Register

func Register(vm *beastjs.VM) error

Register sets vm up as tifa sets up each VM of its pool, in tifa's order: URL and URLSearchParams (url.Register), Intl (intl.Register), Temporal (temporal.Register), then the hooks of Hooks. Call it after the eval timeout is set, as url.Register asks, and before the bundle runs.

Register runs once on a VM: a second call fails, as url.Register refuses a VM that has URL. When a step fails, vm keeps what the steps before it defined: close it.

func RegisterHook

func RegisterHook(vm *beastjs.VM, name string) error

RegisterHook defines on vm the one global of Hooks named name, as Register defines it. It is for a VM that is to have only some of them, such as a test of one, or a measurement that leaves the others out on purpose.

Types

This section is empty.

Jump to

Keyboard shortcuts

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