Documentation
¶
Overview ¶
Package tsgen generates a typed TypeScript client for Go services bound with golet.Bind and events declared with golet.NewEvent.
Types are derived with reflection following the encoding/json/v2 rules used on the wire. Parameter names, documentation and enum values are read from the Go sources when they are available.
Index ¶
Constants ¶
const RuntimePackage = "golet-runtime"
RuntimePackage is the npm package of the page runtime, which generated clients import.
Variables ¶
This section is empty.
Functions ¶
func IsIdentifier ¶
IsIdentifier reports whether s is a valid JavaScript identifier made of ASCII letters, digits, '_' and '$'.
Types ¶
type Event ¶
type Event struct {
Name string
Type reflect.Type
// PC, File and Line locate the declaration, used to find its package
// and documentation.
PC uintptr
File string
Line int
}
Event is a typed event sent from Go to pages.
type Method ¶
type Method struct {
Name string
Params []reflect.Type
// Channels marks the parameters that are channels (golet.Channel),
// whose Params are the type of their values.
Channels []bool
Variadic bool
Result reflect.Type
HasCtx bool
// PC is the entry of the method's code, used to find its source.
PC uintptr
}
Method is a bound method. Params excludes the receiver and an optional leading context.Context (HasCtx).