9#include <toolbox/api_lock.h>
12#pragma GCC diagnostic push
13#pragma GCC diagnostic ignored "-Wattributes"
14#include <jerryscript.h>
15#pragma GCC diagnostic pop
17typedef enum ChildStatus {
23#define JS_RUNNER_MAX_SCRIPT_SIZE (250 * 1024)
27 FuriEventLoopTimer* timer;
28 jerry_value_t callback;
31M_DICT_DEF2(IntervalDict, uint32_t, M_DEFAULT_OPLIST,
IntervalContext, M_POD_OPLIST);
32ARRAY_DEF(ByteArray, uint8_t);
35 JsRunnerConsoleOutCallback callback;
36 void* callback_context;
40 IntervalDict_t intervals;
47 jerry_value_t listen_handler;
48 FuriMessageQueue* input_queue;
52ARRAY_DEF(FetchArray,
JsFetch*, M_PTR_OPLIST);
55 FuriMessageQueue* event_queue;
58typedef enum JsRunnerAppCommandType {
59 JsRunnerAppCommandTypeInvalid,
60 JsRunnerAppCommandTypeAbort,
61 JsRunnerAppCommandTypeRunFile,
62 JsRunnerAppCommandTypeQuit,
63 JsRunnerAppCommandTypeRunSnippet,
65 JsRunnerAppCommandTypeMax,
66} JsRunnerAppCommandType;
80 JsRunnerAppCommandType type;
82 JsRunnerError* result;
90typedef void (*JsRunnerDeferredCallback)(
void* context);
93 JsRunnerDeferredCallback callback;
100 const FuriString* app_id;
105 FuriString* root_path;
109 FuriEventLoop* event_loop;
110 FuriMessageQueue* command_queue;
114 atomic_flag is_execution_handle_taken;
122 DeferredList_t deferred;
126 FuriEventLoop* event_loop;
127 FuriMessageQueue* message_queue;
128 FuriPubSub* fatal_pubsub;
135 FuriMessageQueue* command_queue;
141 JsRunnerEventCallback event_callback;
142 void* event_callback_context;
146 atomic_flag is_running;
150typedef void (*JsRunnerExternalDataDestructor)(
void* object,
void* user_p);
152typedef void (*JsRunnerArrayBufferDestructor)(
void* data);
156 JsRunnerArrayBufferDestructor destructor;
Definition js_runner_types.h:25
Definition js_runner_types.h:79
Definition js_runner_types.h:68
Definition js_runner_types.h:73
Definition js_runner_types.h:34
Definition js_runner_types.h:53
Definition js_runner_types.h:99
FuriEventFlag * is_idle
This flag is set if no script is being run.
Definition js_runner_types.h:107
_Atomic bool should_terminate
Flag to terminate JS busy loops.
Definition js_runner_types.h:113
bool script_evaluation_done
Indicates that the initial evaluation of the script has completed.
Definition js_runner_types.h:112
Definition js_runner_types.h:39
Definition js_runner_types.h:154
Definition js_runner_types.h:131
Definition js_runner_types.h:92
Definition js_runner_types.h:138
Definition js_runner_types.h:125
Definition js_runner_types.h:145