This commit is contained in:
MX 2024-10-15 03:27:04 +03:00
parent edc58c5a0e
commit 8233534d6a
No known key found for this signature in database
GPG key ID: 7CCC66B7DBDD1C83
6 changed files with 55 additions and 5 deletions

View file

@ -129,3 +129,43 @@ App(
requires=["js_app"], requires=["js_app"],
sources=["modules/js_storage.c"], sources=["modules/js_storage.c"],
) )
App(
appid="js_widget",
apptype=FlipperAppType.PLUGIN,
entry_point="js_widget_ep",
requires=["js_app"],
sources=["modules/js_widget.c"],
)
App(
appid="js_vgm",
apptype=FlipperAppType.PLUGIN,
entry_point="js_vgm_ep",
requires=["js_app"],
sources=["modules/js_vgm/*.c", "modules/js_vgm/ICM42688P/*.c"],
)
App(
appid="js_subghz",
apptype=FlipperAppType.PLUGIN,
entry_point="js_subghz_ep",
requires=["js_app"],
sources=["modules/js_subghz/*.c"],
)
App(
appid="js_blebeacon",
apptype=FlipperAppType.PLUGIN,
entry_point="js_blebeacon_ep",
requires=["js_app"],
sources=["modules/js_blebeacon.c"],
)
App(
appid="js_usbdisk",
apptype=FlipperAppType.PLUGIN,
entry_point="js_usbdisk_ep",
requires=["js_app"],
sources=["modules/js_usbdisk/*.c"],
)

View file

@ -193,7 +193,8 @@ static void js_blebeacon_keep_alive(struct mjs* mjs) {
mjs_return(mjs, MJS_UNDEFINED); mjs_return(mjs, MJS_UNDEFINED);
} }
static void* js_blebeacon_create(struct mjs* mjs, mjs_val_t* object) { static void* js_blebeacon_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) {
UNUSED(modules);
JsBlebeaconInst* blebeacon = malloc(sizeof(JsBlebeaconInst)); JsBlebeaconInst* blebeacon = malloc(sizeof(JsBlebeaconInst));
mjs_val_t blebeacon_obj = mjs_mk_object(mjs); mjs_val_t blebeacon_obj = mjs_mk_object(mjs);
mjs_set(mjs, blebeacon_obj, INST_PROP_NAME, ~0, mjs_mk_foreign(mjs, blebeacon)); mjs_set(mjs, blebeacon_obj, INST_PROP_NAME, ~0, mjs_mk_foreign(mjs, blebeacon));
@ -231,6 +232,7 @@ static const JsModuleDescriptor js_blebeacon_desc = {
"blebeacon", "blebeacon",
js_blebeacon_create, js_blebeacon_create,
js_blebeacon_destroy, js_blebeacon_destroy,
NULL,
}; };
static const FlipperAppPluginDescriptor plugin_descriptor = { static const FlipperAppPluginDescriptor plugin_descriptor = {

View file

@ -479,7 +479,8 @@ static void js_subghz_end(struct mjs* mjs) {
mjs_return(mjs, MJS_UNDEFINED); mjs_return(mjs, MJS_UNDEFINED);
} }
static void* js_subghz_create(struct mjs* mjs, mjs_val_t* object) { static void* js_subghz_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) {
UNUSED(modules);
JsSubghzInst* js_subghz = malloc(sizeof(JsSubghzInst)); JsSubghzInst* js_subghz = malloc(sizeof(JsSubghzInst));
mjs_val_t subghz_obj = mjs_mk_object(mjs); mjs_val_t subghz_obj = mjs_mk_object(mjs);
@ -519,6 +520,7 @@ static const JsModuleDescriptor js_subghz_desc = {
"subghz", "subghz",
js_subghz_create, js_subghz_create,
js_subghz_destroy, js_subghz_destroy,
NULL,
}; };
static const FlipperAppPluginDescriptor plugin_descriptor = { static const FlipperAppPluginDescriptor plugin_descriptor = {

View file

@ -167,7 +167,8 @@ static void js_usbdisk_stop(struct mjs* mjs) {
mjs_return(mjs, MJS_UNDEFINED); mjs_return(mjs, MJS_UNDEFINED);
} }
static void* js_usbdisk_create(struct mjs* mjs, mjs_val_t* object) { static void* js_usbdisk_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) {
UNUSED(modules);
JsUsbdiskInst* usbdisk = malloc(sizeof(JsUsbdiskInst)); JsUsbdiskInst* usbdisk = malloc(sizeof(JsUsbdiskInst));
mjs_val_t usbdisk_obj = mjs_mk_object(mjs); mjs_val_t usbdisk_obj = mjs_mk_object(mjs);
mjs_set(mjs, usbdisk_obj, INST_PROP_NAME, ~0, mjs_mk_foreign(mjs, usbdisk)); mjs_set(mjs, usbdisk_obj, INST_PROP_NAME, ~0, mjs_mk_foreign(mjs, usbdisk));
@ -188,6 +189,7 @@ static const JsModuleDescriptor js_usbdisk_desc = {
"usbdisk", "usbdisk",
js_usbdisk_create, js_usbdisk_create,
js_usbdisk_destroy, js_usbdisk_destroy,
NULL,
}; };
static const FlipperAppPluginDescriptor plugin_descriptor = { static const FlipperAppPluginDescriptor plugin_descriptor = {

View file

@ -119,7 +119,8 @@ static void js_vgm_delta_yaw(struct mjs* mjs) {
mjs_return(mjs, mjs_mk_number(mjs, 0)); mjs_return(mjs, mjs_mk_number(mjs, 0));
} }
static void* js_vgm_create(struct mjs* mjs, mjs_val_t* object) { static void* js_vgm_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) {
UNUSED(modules);
JsVgmInst* vgm = malloc(sizeof(JsVgmInst)); JsVgmInst* vgm = malloc(sizeof(JsVgmInst));
vgm->imu = imu_alloc(); vgm->imu = imu_alloc();
vgm->present = imu_present(vgm->imu); vgm->present = imu_present(vgm->imu);
@ -146,6 +147,7 @@ static const JsModuleDescriptor js_vgm_desc = {
name: "vgm", name: "vgm",
create: js_vgm_create, create: js_vgm_create,
destroy: js_vgm_destroy, destroy: js_vgm_destroy,
api_interface: NULL,
}; };
static const FlipperAppPluginDescriptor plugin_descriptor = { static const FlipperAppPluginDescriptor plugin_descriptor = {

View file

@ -810,7 +810,8 @@ static void widget_draw_callback(Canvas* canvas, void* model) {
} }
} }
static void* js_widget_create(struct mjs* mjs, mjs_val_t* object) { static void* js_widget_create(struct mjs* mjs, mjs_val_t* object, JsModules* modules) {
UNUSED(modules);
JsWidgetInst* widget = malloc(sizeof(JsWidgetInst)); JsWidgetInst* widget = malloc(sizeof(JsWidgetInst));
mjs_val_t widget_obj = mjs_mk_object(mjs); mjs_val_t widget_obj = mjs_mk_object(mjs);
@ -908,6 +909,7 @@ static const JsModuleDescriptor js_widget_desc = {
"widget", "widget",
js_widget_create, js_widget_create,
js_widget_destroy, js_widget_destroy,
NULL,
}; };
static const FlipperAppPluginDescriptor widget_plugin_descriptor = { static const FlipperAppPluginDescriptor widget_plugin_descriptor = {