-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup_wasm.go
More file actions
22 lines (19 loc) · 830 Bytes
/
Copy pathsetup_wasm.go
File metadata and controls
22 lines (19 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//go:build js && wasm
package ari
import (
goal "codeberg.org/anaseto/goal"
gos "codeberg.org/anaseto/goal/os"
)
// importPlatformExtensions registers Goal's IO/FS verbs in WASM builds.
//
// SQL requires CGo and is always excluded. The OS option is
// intentionally ignored here: the "import" dyad (and companions like "read",
// "print", "say", "glob", "subfs") work against embedded fs.FS values
// (e.g. libs) without any OS access. Registering them via
// gos.Import is the only way to make `libs import "util"` work in the
// browser REPL. OS-only verbs (chdir, mkdir, run, shell, …) are merely
// registered but will return errors if called at runtime, which is
// acceptable. The SQL option is ignored because CGo is unavailable.
func importPlatformExtensions(ctx *goal.Context, _ Options) {
gos.Import(ctx, "")
}