Contents

JSObjectMakeFunctionWithCallback(_:_:_:)

Creates a JavaScript function with a specified callback as its implementation.

Declaration

func JSObjectMakeFunctionWithCallback(_ ctx: JSContextRef!, _ name: JSStringRef!, _ callAsFunction: JSObjectCallAsFunctionCallback!) -> JSObjectRef!

Parameters

  • ctx:

    The execution context to use.

  • name:

    A Jsstringref that contains the function’s name. The system uses this when converting the function to a string. Pass NULL to create an anonymous function.

  • callAsFunction:

    The Jsobjectcallasfunctioncallback to invoke when calling the function.

Return Value

A JSObjectRef that is a function. The object’s prototype is the default function prototype.

See Also

Working with Objects