diff --git a/documentation/js/js_badusb.md b/documentation/js/js_badusb.md index 23f76c817..dda5a45b7 100644 --- a/documentation/js/js_badusb.md +++ b/documentation/js/js_badusb.md @@ -130,7 +130,7 @@ Prints a string by Alt+Numpad method - works only on Windows! **Parameters** - A string to print -- (optional) delay between key presses +- *(optional)* delay between key presses **Examples** ```js @@ -145,7 +145,7 @@ Same as `altPrint` but ended with "ENTER" press. **Parameters** - A string to print -- (optional) delay between key presses +- *(optional)* delay between key presses **Examples** ```js diff --git a/documentation/js/js_builtin.md b/documentation/js/js_builtin.md index 71a4b2396..4823c13a4 100644 --- a/documentation/js/js_builtin.md +++ b/documentation/js/js_builtin.md @@ -144,7 +144,7 @@ Wrappers around `ArrayBuffer` objects, with dedicated types such as: **Fields** - byteLength: The length of the buffer in bytes -- length: The length of the buffer in bytestyped elements +- length: The length of the buffer in typed elements - buffer: The underlying `ArrayBuffer`
@@ -313,4 +313,3 @@ Checks whether all of the specified extra features are supported by the interpre ```js checkSdkFeatures(["gui-widget"]); ``` -
diff --git a/documentation/js/js_flipper.md b/documentation/js/js_flipper.md new file mode 100644 index 000000000..a4da23868 --- /dev/null +++ b/documentation/js/js_flipper.md @@ -0,0 +1,52 @@ +# Flipper module {#js_flipper} + +The module contains methods and values to query device information and properties. Call the `require` function to load the module before first using its methods: + +```js +let flipper = require("flipper"); +``` + +# Values + +## firmwareVendor +String representing the firmware installed on the device. +Original firmware reports `"flipperdevices"`. +Do **NOT** use this to check the presence or absence of features, refer to [other ways to check SDK compatibility](#js_builtin_sdk_compatibility). + +## jsSdkVersion +Version of the JavaScript SDK. +Do **NOT** use this to check the presence or absence of features, refer to [other ways to check SDK compatibility](#js_builtin_sdk_compatibility). + +
+ +--- + +# Methods + +## getModel() +Returns the device model. + +**Example** +```js +flipper.getModel(); // "Flipper Zero" +``` + +
+ +## getName() +Returns the name of the virtual dolphin. + +**Example** +```js +flipper.getName(); // "Fur1pp44" +``` + +
+ +## getBatteryCharge() +Returns the battery charge percentage. + +**Example** +```js +flipper.getBatteryCharge(); // 100 +``` diff --git a/documentation/js/js_gui__file_picker.md b/documentation/js/js_gui__file_picker.md index 96d5d81b0..a0854f0de 100644 --- a/documentation/js/js_gui__file_picker.md +++ b/documentation/js/js_gui__file_picker.md @@ -18,5 +18,3 @@ Displays a file picker and returns the selected file, or undefined if cancelled. **Returns** A `string` path, or `undefined`. - -
diff --git a/documentation/js/js_gui__icon.md b/documentation/js/js_gui__icon.md index 81208fcaf..7b65417fd 100644 --- a/documentation/js/js_gui__icon.md +++ b/documentation/js/js_gui__icon.md @@ -9,6 +9,7 @@ For an example, refer to the `gui.js` example script. ## getBuiltin() Gets a built-in firmware icon by its name. +All known icons bundled with firmware are supported. **Parameters** - `icon`: name of the icon @@ -29,5 +30,3 @@ It will be automatically unloaded when the script exits. **Returns** An `IconData` object. - -
diff --git a/documentation/js/js_serial.md b/documentation/js/js_serial.md index 763e96b31..c45ae5f74 100644 --- a/documentation/js/js_serial.md +++ b/documentation/js/js_serial.md @@ -77,7 +77,7 @@ Read from serial port until line break character. **Parameters** -*(optional)* Timeout value in ms. +- *(optional)* Timeout value in ms. **Returns** @@ -93,11 +93,11 @@ serial.readln(5000); // Read with 5s timeout
## readAny() -Read any available amount of data from serial port, can help avoid starving your loop with small reads +Read any available amount of data from serial port, can help avoid starving your loop with small reads. **Parameters** -*(optional)* Timeout value in ms +- *(optional)* Timeout value in ms **Returns** diff --git a/documentation/js/js_storage.md b/documentation/js/js_storage.md index 8bd4228ec..6ab437c62 100644 --- a/documentation/js/js_storage.md +++ b/documentation/js/js_storage.md @@ -507,5 +507,3 @@ Deinitialize virtual mount api. **Returns** Nothing on success, error on failure. - -