DynXX-C
Loading...
Searching...
No Matches
Functions
JS.h File Reference
#include "Types.h"

Go to the source code of this file.

Functions

DYNXX_EXTERN_C_BEGIN bool dynxx_js_loadF (const char *file, bool is_module)
 Load JS file.
 
bool dynxx_js_loadS (const char *script, const char *name, bool is_module)
 Load JS Script.
 
bool dynxx_js_loadB (const byte *bytes, size_t len, bool is_module)
 Load JS ByteCode.
 
const char * dynxx_js_call (const char *func, const char *params, bool await)
 Call JS function.
 
void dynxx_js_set_msg_callback (const char *(*const callback)(const char *msg))
 Set JS msg callback.
 

Function Documentation

◆ dynxx_js_call()

const char * dynxx_js_call ( const char *  func,
const char *  params,
bool  await 
)

Call JS function.

Warning
Not accessible in JS/Lua!
Parameters
funcJS function name
paramsJS function params(wrap multiple params with json)
awaitWhether wait for the promise result or not
Returns
return value of JS function

◆ dynxx_js_loadB()

bool dynxx_js_loadB ( const byte bytes,
size_t  len,
bool  is_module 
)

Load JS ByteCode.

Warning
Not accessible in JS/Lua!
Parameters
bytesByte array data
lenByte array length
is_moduleWhether the js import modules or not
Returns
success or not

◆ dynxx_js_loadF()

DYNXX_EXTERN_C_BEGIN bool dynxx_js_loadF ( const char *  file,
bool  is_module 
)

Load JS file.

Warning
Not accessible in JS/Lua!
Parameters
fileJS file path
is_moduleWhether the js import modules or not
Returns
success or not

◆ dynxx_js_loadS()

bool dynxx_js_loadS ( const char *  script,
const char *  name,
bool  is_module 
)

Load JS Script.

Warning
Not accessible in JS/Lua!
Parameters
scriptJS script
nameJS file name
is_moduleWhether the js import modules or not
Returns
success or not

◆ dynxx_js_set_msg_callback()

void dynxx_js_set_msg_callback ( const char *(*)(const char *msg)  callback)

Set JS msg callback.

Parameters
callbackJS msg callback