MCPcopy Create free account
hub / github.com/buke/quickjs-go / AsyncFunction

Method AsyncFunction

context.go:790–792  ·  view source on GitHub ↗

AsyncFunction returns a js async function value with given function template Deprecated: Use Context.NewFunction + Context.NewPromise instead for better memory management and thread safety. Example: asyncFn := ctx.NewFunction(func(ctx *quickjs.Context, this *quickjs.Value, args []*quickjs.Value)

(asyncFn func(ctx *Context, this *Value, promise *Value, args []*Value) *Value)

Source from the content-addressed store, hash-verified

788// })
789// })
790func (ctx *Context) AsyncFunction(asyncFn func(ctx *Context, this *Value, promise *Value, args []*Value) *Value) *Value {
791 return ctx.NewAsyncFunction(asyncFn)
792}
793
794// getFunction gets function from HandleStore (internal use)
795func (ctx *Context) loadFunctionFromHandleID(id int32) interface{} {

Callers 2

TestDeprecatedAPIsFunction · 0.95

Calls 1

NewAsyncFunctionMethod · 0.95

Tested by 2

TestDeprecatedAPIsFunction · 0.76