Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrnoAcces Permission denied. ErrnoAcces = &Errno{"EACCES"} // ErrnoAgain Resource unavailable, or operation would block. ErrnoAgain = &Errno{"EAGAIN"} // ErrnoBadf Bad file descriptor. ErrnoBadf = &Errno{"EBADF"} // ErrnoExist File exists. ErrnoExist = &Errno{"EEXIST"} // ErrnoFault Bad address. ErrnoFault = &Errno{"EFAULT"} // ErrnoIntr Interrupted function. ErrnoIntr = &Errno{"EINTR"} // ErrnoInval Invalid argument. ErrnoInval = &Errno{"EINVAL"} // ErrnoIo I/O error. ErrnoIo = &Errno{"EIO"} // ErrnoIsdir Is a directory. ErrnoIsdir = &Errno{"EISDIR"} // ErrnoLoop Too many levels of symbolic links. ErrnoLoop = &Errno{"ELOOP"} // ErrnoNametoolong Filename too long. ErrnoNametoolong = &Errno{"ENAMETOOLONG"} // ErrnoNoent No such file or directory. ErrnoNoent = &Errno{"ENOENT"} // ErrnoNosys function not supported. ErrnoNosys = &Errno{"ENOSYS"} // ErrnoNotdir Not a directory or a symbolic link to a directory. ErrnoNotdir = &Errno{"ENOTDIR"} // ErrnoNotempty Directory not empty. ErrnoNotempty = &Errno{"ENOTEMPTY"} // ErrnoNotsup Not supported, or operation not supported on socket. ErrnoNotsup = &Errno{"ENOTSUP"} // ErrnoPerm Operation not permitted. ErrnoPerm = &Errno{"EPERM"} // ErrnoRofs read-only file system. ErrnoRofs = &Errno{"EROFS"} )
This order match constants from wasi_snapshot_preview1.ErrnoSuccess for easier maintenance.
var ClearTimeoutEvent = goarch.NewFunc(custom.NameRuntimeClearTimeoutEvent, clearTimeoutEvent)
ClearTimeoutEvent implements runtime.clearTimeoutEvent which supports runtime.notetsleepg used by runtime.signal_recv.
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.s#L129
var CopyBytesToGo = goos.NewFunc(custom.NameSyscallCopyBytesToGo, copyBytesToGo)
CopyBytesToGo copies a JavaScript managed byte array to linear memory. For example, this is used to read an HTTP response body.
Results ¶
- n is the count of bytes written.
- ok is false if the src was not a uint8Array.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L569 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L437-L449
var CopyBytesToJS = goos.NewFunc(custom.NameSyscallCopyBytesToJS, copyBytesToJS)
CopyBytesToJS copies linear memory to a JavaScript managed byte array. For example, this is used to read an HTTP request body.
Results ¶
- n is the count of bytes written.
- ok is false if the dst was not a uint8Array.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L583 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L438-L448
var Debug = goarch.StubFunction(custom.NameDebug)
Debug has unknown use, so stubbed.
See https://github.com/golang/go/blob/go1.20/src/cmd/link/internal/wasm/asm.go#L131-L136
var FinalizeRef = goos.NewFunc(custom.NameSyscallFinalizeRef, finalizeRef)
FinalizeRef implements js.finalizeRef, which is used as a runtime.SetFinalizer on the given reference.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L61
var GetRandomData = goarch.NewFunc(custom.NameRuntimeGetRandomData, getRandomData)
GetRandomData implements runtime.getRandomData, which initializes the seed for runtime.fastrand.
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.s#L133
var NaN = math.NaN()
var Nanotime1 = goarch.NewFunc(custom.NameRuntimeNanotime1, nanotime1)
Nanotime1 implements runtime.nanotime which supports time.Since.
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.s#L117
var ResetMemoryDataView = goarch.NewFunc(custom.NameRuntimeResetMemoryDataView, resetMemoryDataView)
ResetMemoryDataView signals wasm.OpcodeMemoryGrow happened, indicating any cached view of memory should be reset.
See https://github.com/golang/go/blob/go1.20/src/runtime/mem_js.go#L82
var ScheduleTimeoutEvent = goarch.NewFunc(custom.NameRuntimeScheduleTimeoutEvent, scheduleTimeoutEvent)
ScheduleTimeoutEvent implements runtime.scheduleTimeoutEvent which supports runtime.notetsleepg used by runtime.signal_recv.
Unlike other most functions prefixed by "runtime.", this both launches a goroutine and invokes code compiled into wasm "resume".
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.s#L125
var StringVal = goos.NewFunc(custom.NameSyscallStringVal, stringVal)
StringVal implements js.stringVal, which is used to load the string for `js.ValueOf(x)`. For example, this is used when setting HTTP headers.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L212 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L305-L308
var ValueCall = goos.NewFunc(custom.NameSyscallValueCall, valueCall)
ValueCall implements js.valueCall, which is used to call a js.Value function by name, e.g. `document.Call("createElement", "div")`.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L394 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L343-L358
var ValueDelete = goarch.StubFunction(custom.NameSyscallValueDelete)
ValueDelete is stubbed as it isn't used in Go's main source tree.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L321
var ValueGet = goos.NewFunc(custom.NameSyscallValueGet, valueGet)
ValueGet implements js.valueGet, which is used to load a js.Value property by name, e.g. `v.Get("address")`. Notably, this is used by js.handleEvent to get the pending event.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L295 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L311-L316
var ValueIndex = goos.NewFunc(custom.NameSyscallValueIndex, valueIndex)
ValueIndex implements js.valueIndex, which is used to load a js.Value property by index, e.g. `v.Index(0)`. Notably, this is used by js.handleEvent to read event arguments
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L334 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L331-L334
var ValueInstanceOf = goarch.StubFunction(custom.NameSyscallValueInstanceOf)
ValueInstanceOf is stubbed as it isn't used in Go's main source tree.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L543
var ValueInvoke = goarch.StubFunction(custom.NameSyscallValueInvoke)
ValueInvoke is stubbed as it isn't used in Go's main source tree.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L413
var ValueLength = goos.NewFunc(custom.NameSyscallValueLength, valueLength)
ValueLength implements js.valueLength, which is used to load the length property of a value, e.g. `array.length`.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L372 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L395-L398
var ValueLoadString = goos.NewFunc(custom.NameSyscallValueLoadString, valueLoadString)
ValueLoadString implements js.valueLoadString, which is used copy a string value for `o.String()`.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L533 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L409-L413
var ValueNew = goos.NewFunc(custom.NameSyscallValueNew, valueNew)
ValueNew implements js.valueNew, which is used to call a js.Value, e.g. `array.New(2)`.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L432 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L378-L392
var ValuePrepareString = goos.NewFunc(custom.NameSyscallValuePrepareString, valuePrepareString)
ValuePrepareString implements js.valuePrepareString, which is used to load the string for `o.String()` (via js.jsString) for string, boolean and number types. Notably, http.Transport uses this in RoundTrip to coerce the URL to a string.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L531 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L401-L406
var ValueSet = goos.NewFunc(custom.NameSyscallValueSet, valueSet)
ValueSet implements js.valueSet, which is used to store a js.Value property by name, e.g. `v.Set("address", a)`. Notably, this is used by js.handleEvent set the event result.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L309 and https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L318-L322
var ValueSetIndex = goarch.StubFunction(custom.NameSyscallValueSetIndex)
ValueSetIndex is stubbed as it is only used for js.ValueOf when the input is []interface{}, which doesn't appear to occur in Go's source tree.
See https://github.com/golang/go/blob/go1.20/src/syscall/js/js.go#L348
var Walltime = goarch.NewFunc(custom.NameRuntimeWalltime, walltime)
Walltime implements runtime.walltime which supports time.Now.
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.s#L121
var WasmExit = goarch.NewFunc(custom.NameRuntimeWasmExit, wasmExit)
WasmExit implements runtime.wasmExit which supports runtime.exit.
See https://github.com/golang/go/blob/go1.20/src/runtime/sys_wasm.go#L24
var WasmWrite = goarch.NewFunc(custom.NameRuntimeWasmWrite, wasmWrite)
WasmWrite implements runtime.wasmWrite which supports runtime.write and runtime.writeErr. This implements `println`.
See https://github.com/golang/go/blob/go1.20/src/runtime/os_js.go#L30
Functions ¶
func GetLastEventArgs ¶
GetLastEventArgs implements goos.GetLastEventArgs
func LoadValue ¶
LoadValue reads up to 8 bytes at the memory offset `addr` to return the value written by storeValue.
See https://github.com/golang/go/blob/go1.20/misc/wasm/wasm_exec.js#L122-L133
Types ¶
type Errno ¶
type Errno struct {
// contains filtered or unexported fields
}
Errno is a (GOARCH=wasm) error, which must match a key in mapJSError.
See https://github.com/golang/go/blob/go1.20/src/syscall/tables_js.go#L371-L494
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package config exists to avoid dependency cycles when keeping most of gojs code internal.
|
Package config exists to avoid dependency cycles when keeping most of gojs code internal. |
Package custom is similar to the WebAssembly Custom Sections.
|
Package custom is similar to the WebAssembly Custom Sections. |
Package goarch isolates code from runtime.GOARCH=wasm in a way that avoids cyclic dependencies when re-used from other packages.
|
Package goarch isolates code from runtime.GOARCH=wasm in a way that avoids cyclic dependencies when re-used from other packages. |
Package goos isolates code from runtime.GOOS=js in a way that avoids cyclic dependencies when re-used from other packages.
|
Package goos isolates code from runtime.GOOS=js in a way that avoids cyclic dependencies when re-used from other packages. |
Package run exists to avoid dependency cycles when keeping most of gojs code internal.
|
Package run exists to avoid dependency cycles when keeping most of gojs code internal. |