gojs: stubs all remaining filesystem calls to ENOSYS (#1001)

This stubs all remaining syscalls for `GOARCH=wasm GOOS=js` to return
ENOSYS, instead of panic'ing. This allows us to see the parameters it
receives.

For example:
```
==> go.syscall/js.valueCall(fs.truncate(path=/tmp/_Go_TestTruncate135754730,length=0))
<== (err=function not implemented,ok=false)
```

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-01-03 15:54:29 +08:00
committed by GitHub
parent ef3937ffed
commit 65c7d9dd1b
11 changed files with 417 additions and 205 deletions

View File

@@ -9,6 +9,8 @@ import (
)
// jsFn is a jsCall.call function, configured via jsVal.addFunction.
//
// Note: This is not a `func` because we need it to be a hashable type.
type jsFn interface {
invoke(ctx context.Context, mod api.Module, args ...interface{}) (interface{}, error)
}