mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
add jsutil.Error / jsutil.Errorf
This commit is contained in:
parent
9137dc1dcc
commit
5e18504eb9
@ -34,6 +34,14 @@ func NewPromise(fn js.Func) js.Value {
|
||||
return PromiseClass.New(fn)
|
||||
}
|
||||
|
||||
func Error(msg string) js.Value {
|
||||
return ErrorClass.New(msg)
|
||||
}
|
||||
|
||||
func Errorf(format string, args ...any) js.Value {
|
||||
return ErrorClass.New(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
// ArrayFrom calls Array.from to given argument and returns result Array.
|
||||
func ArrayFrom(v js.Value) js.Value {
|
||||
return ArrayClass.Call("from", v)
|
||||
|
Loading…
x
Reference in New Issue
Block a user