mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 05:06:30 +04:00
js modules updates
by Willy-JL
This commit is contained in:
24
applications/system/js_app/examples/apps/Scripts/textbox.js
Normal file
24
applications/system/js_app/examples/apps/Scripts/textbox.js
Normal file
@@ -0,0 +1,24 @@
|
||||
let textbox = require("textbox");
|
||||
|
||||
// Set config before setting text
|
||||
// Focus (start / end), Font (text / hex)
|
||||
textbox.setConfig("end", "text");
|
||||
|
||||
let text = "Example dynamic updating textbox\n";
|
||||
textbox.setText(text);
|
||||
|
||||
// Non-blocking, can keep updating text after, can close in JS or in GUI
|
||||
textbox.show();
|
||||
|
||||
let i = 0;
|
||||
while (textbox.isOpen() && i < 20) {
|
||||
print("console", i++);
|
||||
text += "textbox " + to_string(i) + "\n";
|
||||
textbox.setText(text);
|
||||
delay(500);
|
||||
}
|
||||
|
||||
// If not closed by user (instead i < 20 is false above), close forcefully
|
||||
if (textbox.isOpen()) {
|
||||
textbox.close();
|
||||
}
|
||||
Reference in New Issue
Block a user