BSB Developer Docs
Loading...
Searching...
No Matches
js_runner_i.h File Reference

Javascript app runner - private declarations. More...

#include "js_runner.h"
#include "js_util.h"
#include "js_runner_types.h"
#include <furi/furi.h>
#include <storage/storage.h>
#include <path.h>
#include <fetch/fetch.h>
#include <jerryscript.h>

Go to the source code of this file.

Macros

#define JS_TRACE(...)
 
#define MIN_INTERVAL_DELAY_MS   10.0f
 
#define MAX_FETCH_MESSAGES   32
 
#define MAX_COMMAND_MESSAGES   4
 
#define APP_THREAD_STACK_SIZE   (8 * 1024)
 
#define JS_RUNNER_APP_FLAG_IDLE   1
 
#define PTR_HASH(p)
 
#define WITH_JS_RUNNER_APP(APP, BLOCK)
 
#define JS_ARG(n)
 
#define JS_ARG_OR_UNDEFINED(n)
 

Functions

void js_runner_app_stop_if_done (JsRunnerApp *app)
 
void js_run_jobs (void)
 
size_t js_runner_thread_context_alloc (size_t context_size)
 Allocate Jerryscript context for current thread.
 
void js_runner_thread_context_free (void)
 Free Jerryscript context for current thread.
 
void * js_runner_thread_context_get (void)
 Get Jerryscript context for current thread.
 
void js_runner_handle_fatal_error (jerry_fatal_code_t code)
 
bool js_runner_get_root_path (FuriString *path)
 Get root path of the current JS app (folder containing entry point).
 
void js_runner_add_fetch_thread (JsRunnerApp *app, JsFetch *fetch)
 
void js_runner_del_fetch_thread (JsRunnerApp *app, JsFetch *fetch)
 
const char * js_runner_app_get_id (const JsRunnerApp *app)
 
void js_runner_heap_destructor (void *object, void *user_p)
 
void js_runner_defer (JsRunnerApp *app, JsRunnerDeferredCallback cb, void *context)
 Defer execution of a callback until before jerry_cleanup.
 
void js_runner_cancel_defer (JsRunnerApp *app, JsRunnerDeferredCallback cb, void *context)
 Cancel a deferred callback execution.
 

Variables

JsRunnerStaticContext js_runner_static_context
 

Detailed Description

Javascript app runner - private declarations.

Macro Definition Documentation

◆ JS_ARG

#define JS_ARG ( n)
Value:
(args[(n)])

◆ JS_ARG_OR_UNDEFINED

#define JS_ARG_OR_UNDEFINED ( n)
Value:
(args_count > (n) ? args[(n)] : jerry_undefined())

◆ PTR_HASH

#define PTR_HASH ( p)
Value:
((size_t)(p))

◆ WITH_JS_RUNNER_APP

#define WITH_JS_RUNNER_APP ( APP,
BLOCK )
Value:
do { \
JsRunnerApp* APP = js_runner_static_context.app; \
furi_assert(APP->thread == furi_thread_get_current()); \
BLOCK \
} while(false)
Definition js_runner_types.h:99

Function Documentation

◆ js_runner_get_root_path()

bool js_runner_get_root_path ( FuriString * path)

Get root path of the current JS app (folder containing entry point).

This function is used by jerryscript glue.

Returns
true if root path (and file operations) is available, false otherwise

◆ js_runner_thread_context_alloc()

size_t js_runner_thread_context_alloc ( size_t context_size)

Allocate Jerryscript context for current thread.

This function is used by jerryscript glue.

Jerryscript uses global context. JsRunner keeps track of jerryscript context, allocating a separate context instance for each thread.

◆ js_runner_thread_context_free()

void js_runner_thread_context_free ( void )

Free Jerryscript context for current thread.

This function is used by jerryscript glue.

Jerryscript uses global context. JsRunner keeps track of jerryscript context, allocating a separate context instance for each thread.

◆ js_runner_thread_context_get()

void * js_runner_thread_context_get ( void )

Get Jerryscript context for current thread.

This function is used by jerryscript glue.

Jerryscript uses global context. JsRunner keeps track of jerryscript context, allocating a separate context instance for each thread.