Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions Browser_IDE/IDEStartupMain.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
// TODO: refactor this so that it's clearer where each
// global variable is initialized/setup (should they be
// global in the first place? Probably not...)
async function StartIDE() {
makingNewProject = true;

// Interface setup
createGutterSplitters();
setupLanguageSelectionBox();

// Initialize language
setupActiveLanguage();
setupIDEButtonEvents(); // uses current language
setupIDEButtonEvents();

// Create execution environment and project storage objects
// These constructors don't _do_ anything important.
executionEnviroment = new ExecutionEnvironment(document.getElementById("ExecutionEnvironment"), activeLanguageSetup);
appStorage = new AppStorage();
storedProject = new IDBStoredProject(appStorage, activeLanguageSetup.getDefaultProject());
Expand All @@ -26,44 +23,51 @@ async function StartIDE() {
setupProjectConflictAndConfirmationModals();
setupCodeEditorCallbacks();
setupFilePanelAndEvents();

setupMinifiedInterface();

// Initialize compiler in parallel with everything else
// This is where the bulk of the startup occurs
await Promise.all([
(async () => {
await initializeLanguageCompilerFiles(activeLanguageSetup);
executionEnviroment.updateCompilerLoadProgress(1);
})(),
(async () => {
// Initialize execution environment
// in parallel with project+treeview
await Promise.all([
executionEnviroment.initialize(),
(async () => {
await appStorage.attach();
await storedProject.attachToProject();

// Load project from URL if specified
if (SKO.projectURL) {
try {
console.log(`Loading project from URL: ${SKO.projectURL}`);
await loadProjectFromURL(SKO.projectURL);
console.log("Project loaded successfully.");
} catch (error) {
console.error("Error loading project from URL:", error);
}
}

openCodeEditors();
})()
])
]);

makingNewProject = false;

// mirror project once execution environment +
// project are ready
// Mirror project once execution environment + project are ready
await mirrorProject();
})()
]);

// enable code execution once project is mirrored to the execution
// environment and compiler is ready.
// Enable code execution once project is mirrored to the execution environment and compiler is ready
updateCodeExecutionState();

AddWindowListeners();
}

StartIDE();
// Focus the window for detecting user interaction inside the iFrame
window.focus();

// Focus the window, this is used in order to detect if the user clicks inside the iFrame containing the program
window.focus();
// Start the IDE
StartIDE();
Loading
Loading