Native Functions

Native Functions

Functions

Includes

#include <seed/seed.h>

Description

Functions

SeedFunctionCallback ()

SeedValue
(*SeedFunctionCallback) (SeedContext ctx,
                         SeedObject function,
                         SeedObject this_object,
                         gsize argument_count,
                         const SeedValue arguments[],
                         SeedException *exception);

All native C function callbacks should use the prototype of SeedFunctionCallback.

Parameters

ctx

A SeedContext

 

function

The SeedObject representing the function

 

this_object

The SeedObject representing the "this" object in the caller

 

argument_count

The number of arguments passed into the callback

 

arguments

An array of SeedValues; the value of the arguments passed in

 

exception

A reference to a SeedException; use seed_make_exception() in order to throw a JavaScript exception from the callback.

 

Returns

The SeedValue to return to the caller


seed_make_function ()

SeedObject
seed_make_function (SeedContext ctx,
                    SeedFunctionCallback func,
                    const gchar *name);

Creates a JavaScript object representing a first-class function; when the function is called from JavaScript, func will be called.

Parameters

ctx

A valid SeedContext

 

func

A SeedFunctionCallback to implement the function.

 

name

The name of the function (used in exceptions).

 

Returns

A SeedObject representing the function


seed_create_function ()

void
seed_create_function (SeedContext ctx,
                      gchar *name,
                      SeedFunctionCallback func,
                      SeedObject obj);

Creates a JavaScript object representing a first-class function; when the function is called from JavaScript, func will be called. Places the created function as the property name on obj .

Parameters

ctx

A valid SeedContext

 

name

The name of the function (used in exceptions).

 

func

A SeedFunctionCallback to implement the function.

 

obj

The SeedObject on which to put the function.

 

Types and Values