Technical Guide: Developing for Infinity OS
1. Working with system dialogs and awaitIn Infinity OS, standard user interaction methods are rewritten for asynchronous execution. This allows you to avoid blocking the main thread and write clean, linear code.
Asynchrony: The confirm and prompt methods require the use of await. The system stops the application script execution until a response is received from the user.
Syntax:
// Example of receiving confirmation
const isConfirmed = await parent.confirm("Really?");
// Data input
const userName = await parent.prompt("What's your name?");
2. Specifics of HTML applications and the parent objectIf your application is HTML (loaded in an iframe), it is isolated from the global context system. To access system functions, variables, and APIs, you must always use the parent prefix.
Console and dialogs: parent.console, parent.alert, parent.prompt, parent.confirm.
System variables: parent.fs (файлова система), parent.apps (список додатків).
Віконний менеджер: parent.wm.
Ex. 1 - reading additional files:
Для пошуку внутрішніх ресурсів додатка у віртуальній ФС використовуйте:
const f = parent.fs.find(f => f.name.endsWith("folder/file.txt"));
if (f) {
parent.console.log("Файл знайдено: " + f.name);
}