Share via


JsCreateFunction Function

Creates a new JavaScript function.

Syntax

STDAPI_(JsErrorCode) JsCreateFunction(  
   _In_ JsNativeFunction nativeFunction,  
   _In_opt_ void *callbackState,  
   _Out_ JsValueRef *function  
);  

Parameters

nativeFunction
The method to call when the function is invoked.

callbackState
User-provided state that will be passed back to the callback.

function
The new function object.

Return Value

The result of the call, if any.

Remarks

Requires an active script context.

Requirements

Header: jsrt.h

See Also

Reference (JavaScript Runtime)