mirror of
https://github.com/flipperdevices/flipperzero-firmware.git
synced 2025-12-12 12:51:22 +04:00
JS Documentation (#3535)
* Initial JS documentation * Spelling fix Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
56
documentation/js/js_builtin.md
Normal file
56
documentation/js/js_builtin.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Built-in methods {#js_builtin}
|
||||
|
||||
## require
|
||||
Load a module plugin.
|
||||
|
||||
### Parameters
|
||||
- Module name
|
||||
|
||||
### Examples:
|
||||
```js
|
||||
let serial = require("serial"); // Load "serial" module
|
||||
```
|
||||
|
||||
## delay
|
||||
### Parameters
|
||||
- Delay value in ms
|
||||
|
||||
### Examples:
|
||||
```js
|
||||
delay(500); // Delay for 500ms
|
||||
```
|
||||
## print
|
||||
Print a message on a screen console.
|
||||
|
||||
### Parameters
|
||||
The following argument types are supported:
|
||||
- String
|
||||
- Number
|
||||
- Bool
|
||||
- undefined
|
||||
|
||||
### Examples:
|
||||
```js
|
||||
print("string1", "string2", 123);
|
||||
```
|
||||
|
||||
## console.log
|
||||
## console.warn
|
||||
## console.error
|
||||
## console.debug
|
||||
Same as `print`, but output to serial console only, with corresponding log level.
|
||||
|
||||
## to_string
|
||||
Convert a number to string.
|
||||
|
||||
### Examples:
|
||||
```js
|
||||
to_string(123)
|
||||
```
|
||||
## to_hex_string
|
||||
Convert a number to string(hex format).
|
||||
|
||||
### Examples:
|
||||
```js
|
||||
to_hex_string(0xFF)
|
||||
```
|
||||
Reference in New Issue
Block a user