Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FL-3893] JS modules #3841

Merged
merged 71 commits into from
Oct 14, 2024
Merged

[FL-3893] JS modules #3841

merged 71 commits into from
Oct 14, 2024

Conversation

portasynthinca3
Copy link
Member

@portasynthinca3 portasynthinca3 commented Aug 14, 2024

What's new

  • JS modules: event_loop, gpio,gui and storage
    • JS gui submodules: gui/loading, gui/submenu, gui/empty_screen, gui/text_input, gui/text_box, gui/dialog
  • Documentation for these modules
  • TS type declarations for these modules
  • JS example scripts for these modules (except storage)
  • Some tests for some of the modules
  • Removed legacy JS modules: submenu (superseded by gui/submenu), textbox (superseded by gui/text_box), dialog (superseded by gui/dialog)
  • TextInputModel field: minimum_length
  • SDK API functions: text_input_set_minimum_length , furi_event_loop_is_subscribed
  • Static inline convenience function: furi_event_loop_maybe_unsubscribe

Verification

  • Run unit tests
  • For modules that require access to the outside world (gpio, gui):
    • Build and flash the firmware
    • Run gpio and gui JS example scripts
    • Verify that the examples work as intended

Remarks

Performance

The GUI example is quite heavy, requiring about 32 KiB of heap space with all the GUI modules loaded. The script starts up slowly compared to other scripts (~500ms), but runs just fine.

Readability

The later the date of creation of a module, the more its implementation looks like it's written in a DSL. Without all these macros the code would just become 80% noise, and thus a huge pain in the butt to write and maintain.

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

Copy link

github-actions bot commented Aug 14, 2024

PVS-Studio report for commit af6c6171:

@portasynthinca3 portasynthinca3 added the JS JS Runtime, loader and API label Aug 14, 2024
Copy link

github-actions bot commented Aug 14, 2024

Compiled f7 firmware for commit 70dbb41e:

@portasynthinca3 portasynthinca3 changed the title [FL-3893] JS backport [FL-3893] JS modules Aug 26, 2024
furi/core/event_loop.c Outdated Show resolved Hide resolved
applications/system/js_app/js_modules.c Outdated Show resolved Hide resolved
applications/system/js_app/js_modules.c Outdated Show resolved Hide resolved
applications/system/js_app/js_modules.h Outdated Show resolved Hide resolved
applications/system/js_app/modules/js_gpio.c Show resolved Hide resolved
applications/system/js_app/modules/js_gpio.c Outdated Show resolved Hide resolved
applications/system/js_app/modules/js_gpio.c Outdated Show resolved Hide resolved
applications/system/js_app/modules/js_gpio.c Show resolved Hide resolved
applications/system/js_app/modules/js_gui/js_gui.c Outdated Show resolved Hide resolved
@skotopes skotopes marked this pull request as draft October 14, 2024 13:56
@skotopes
Copy link
Member

un draft when ready

@portasynthinca3 portasynthinca3 marked this pull request as ready for review October 14, 2024 16:04
@skotopes skotopes merged commit 8a95cb8 into dev Oct 14, 2024
11 checks passed
@skotopes skotopes deleted the portasynthinca3/3893-js-backport branch October 14, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JS JS Runtime, loader and API New Feature Contains an IMPLEMENTATION of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants