Fork me on GitHub
Loading...
Searching...
No Matches
Functions
janus_duktape_extra.h File Reference

Janus Duktape plugin extra hooks (headers) More...

#include <duktape.h>
Include dependency graph for janus_duktape_extra.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void janus_duktape_register_extra_functions (duk_context *ctx)
 Method to register extra JavaScript functions in the C code.
 

Detailed Description

Janus Duktape plugin extra hooks (headers)

Author
Lorenzo Miniero loren.nosp@m.zo@m.nosp@m.eetec.nosp@m.ho.c.nosp@m.om

The Janus Duktape plugin implements all the mandatory hooks to allow the C code to interact with a custom JavaScript script, and viceversa. Anyway, JavaScript developers may want to have the C code do more than what is provided out of the box, e.g., by exposing additional JavaScript methods from C for further low level processing or native integration. This "extra" implementation provides a mechanism to do just that, as developers can just add their own custom hooks in the C extra code, and the Duktape plugin will register the new methods along the stock ones.

More specifically, the Janus Duktape plugin will always invoke the janus_duktape_register_extra_functions() method when initializing. This means that all developers will need to do to register a new function is adding new duk_push_c_function calls to register their own functions there, and they'll be added to the stack.

Duktape plugin API

Function Documentation

◆ janus_duktape_register_extra_functions()

void janus_duktape_register_extra_functions ( duk_context *  ctx)

Method to register extra JavaScript functions in the C code.

Parameters
[in]ctxThe Duktape context to register the functions on