unleashed-firmware/documentation/js/js_dialog.md
Ruslan Nadyrshin 9a02e23dc7
New js modules documentation added (#3736)
* New js modules documentation added
* Documentation: Spelling and formatting

Co-authored-by: ElectronicsInFocus <rnadyrshin@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
2024-06-30 12:18:46 +01:00

1,010 B

js_dialog

Dialog module

let dialog = require("dialog");

Methods

message

Show a simple message dialog with header, text and "OK" button.

Parameters

  • Dialog header text
  • Dialog text

Returns

true if central button was pressed, false if the dialog was closed by back key press

Examples:

dialog.message("Dialog demo", "Press OK to start");

custom

More complex dialog with configurable buttons

Parameters

Configuration object with the following fields:

  • header: Dialog header text
  • text: Dialog text
  • button_left: (optional) left button name
  • button_right: (optional) right button name
  • button_center: (optional) central button name

Returns

Name of pressed button or empty string if the dialog was closed by back key press

Examples:

let dialog_params = ({
    header: "Dialog header",
    text: "Dialog text",
    button_left: "Left",
    button_right: "Right",
    button_center: "OK"
});

dialog.custom(dialog_params);