1
mirror of https://github.com/flipperdevices/flipperzero-firmware.git synced 2025-12-12 20:59:50 +04:00

[FL-3925, FL-3942, FL-3944] JS features & bugfixes (SDK 0.2) (#4075)

* feat: JS GPIO PWM, JS GUI Widget view; fix: JS EvtLoop stop on request, JS EvtLoop stop on error
* fix: f18 build
* docs: widget
* fix: js unit test
* change feature naming

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Anna Antonenko
2025-02-13 12:50:38 +04:00
committed by GitHub
parent ac1b723436
commit e27f82f041
33 changed files with 858 additions and 104 deletions

View File

@@ -27,23 +27,23 @@ always access the canvas through a viewport.
In Flipper's terminology, a "View" is a fullscreen design element that assumes
control over the entire viewport and all input events. Different types of views
are available (not all of which are unfortunately currently implemented in JS):
| View | Has JS adapter? |
|----------------------|------------------|
| `button_menu` | ❌ |
| `button_panel` | ❌ |
| `byte_input` | |
| `dialog_ex` | ✅ (as `dialog`) |
| `empty_screen` | ✅ |
| `file_browser` | |
| `loading` | ✅ |
| `menu` | ❌ |
| `number_input` | ❌ |
| `popup` | ❌ |
| `submenu` | ✅ |
| `text_box` | ✅ |
| `text_input` | ✅ |
| `variable_item_list` | ❌ |
| `widget` | |
| View | Has JS adapter? |
|----------------------|-----------------------|
| `button_menu` | ❌ |
| `button_panel` | ❌ |
| `byte_input` | |
| `dialog_ex` | ✅ (as `dialog`) |
| `empty_screen` | ✅ |
| `file_browser` | ✅ (as `file_picker`) |
| `loading` | ✅ |
| `menu` | ❌ |
| `number_input` | ❌ |
| `popup` | ❌ |
| `submenu` | ✅ |
| `text_box` | ✅ |
| `text_input` | ✅ |
| `variable_item_list` | ❌ |
| `widget` | |
In JS, each view has its own set of properties (or just "props"). The programmer
can manipulate these properties in two ways:

View File

@@ -0,0 +1,25 @@
# js_gui__widget {#js_gui__widget}
# Widget GUI view
Displays a combination of custom elements on one screen
<img src="widget.png" width="200" alt="Sample screenshot of the view" />
```js
let eventLoop = require("event_loop");
let gui = require("gui");
let widgetView = require("gui/widget");
```
This module depends on the `gui` module, which in turn depends on the
`event_loop` module, so they _must_ be imported in this order. It is also
recommended to conceptualize these modules first before using this one.
# Example
For an example refer to the `gui.js` example script.
# View props
This view does not have any props.
# Children
This view has the elements as its children.