mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 13:09:49 +04:00
merge fix [ci skip]
with some parts from PR by Willy-JL https://github.com/flipperdevices/flipperzero-firmware/pull/3980/files
This commit is contained in:
@@ -244,30 +244,6 @@ static int32_t js_thread(void* arg) {
|
||||
struct mjs* mjs = mjs_create(worker);
|
||||
worker->modules = js_modules_create(mjs, worker->resolver);
|
||||
mjs_val_t global = mjs_get_global(mjs);
|
||||
if(worker->path) {
|
||||
FuriString* dirpath = furi_string_alloc();
|
||||
path_extract_dirname(furi_string_get_cstr(worker->path), dirpath);
|
||||
mjs_set(
|
||||
mjs,
|
||||
global,
|
||||
"__filename",
|
||||
~0,
|
||||
mjs_mk_string(
|
||||
mjs, furi_string_get_cstr(worker->path), furi_string_size(worker->path), true));
|
||||
mjs_set(
|
||||
mjs,
|
||||
global,
|
||||
"__dirname",
|
||||
~0,
|
||||
mjs_mk_string(mjs, furi_string_get_cstr(dirpath), furi_string_size(dirpath), true));
|
||||
furi_string_free(dirpath);
|
||||
}
|
||||
mjs_set(mjs, global, "print", ~0, MJS_MK_FN(js_print));
|
||||
mjs_set(mjs, global, "delay", ~0, MJS_MK_FN(js_delay));
|
||||
mjs_set(mjs, global, "ffi_address", ~0, MJS_MK_FN(js_ffi_address));
|
||||
mjs_set(mjs, global, "require", ~0, MJS_MK_FN(js_require));
|
||||
mjs_set(mjs, global, "parseInt", ~0, MJS_MK_FN(js_parse_int));
|
||||
|
||||
mjs_val_t console_obj = mjs_mk_object(mjs);
|
||||
|
||||
if(worker->path) {
|
||||
@@ -292,7 +268,6 @@ static int32_t js_thread(void* arg) {
|
||||
JS_ASSIGN_MULTI(mjs, global) {
|
||||
JS_FIELD("print", MJS_MK_FN(js_print));
|
||||
JS_FIELD("delay", MJS_MK_FN(js_delay));
|
||||
JS_FIELD("toString", MJS_MK_FN(js_global_to_string));
|
||||
JS_FIELD("parseInt", MJS_MK_FN(js_parse_int));
|
||||
JS_FIELD("ffi_address", MJS_MK_FN(js_ffi_address));
|
||||
JS_FIELD("require", MJS_MK_FN(js_require));
|
||||
|
||||
Reference in New Issue
Block a user