mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-27 03:49:58 -07:00
- Add new doc on Storage module - Improve formatting in the JS section for better readability
67 lines
827 B
Markdown
67 lines
827 B
Markdown
# Built-in methods {#js_builtin}
|
|
|
|
## require()
|
|
Load a module plugin.
|
|
|
|
**Parameters**
|
|
- Module name
|
|
|
|
**Examples**
|
|
```js
|
|
let serial = require("serial"); // Load "serial" module
|
|
```
|
|
|
|
<br>
|
|
|
|
## delay()
|
|
**Parameters**
|
|
- Delay value in ms
|
|
|
|
**Examples**
|
|
```js
|
|
delay(500); // Delay for 500ms
|
|
```
|
|
<br>
|
|
|
|
## 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);
|
|
```
|
|
<br>
|
|
|
|
## console.log()
|
|
|
|
<br>
|
|
|
|
## console.warn()
|
|
|
|
<br>
|
|
|
|
## console.error()
|
|
|
|
<br>
|
|
|
|
## console.debug()
|
|
Same as `print`, but output to serial console only, with corresponding log level.
|
|
|
|
<br>
|
|
|
|
## to_string()
|
|
Convert a number to string with an optional base.
|
|
|
|
**Examples**
|
|
```js
|
|
to_string(123) // "123"
|
|
to_string(123, 16) // "0x7b"
|
|
```
|