win32.run
AppGithub
  • Introduction
  • Acknowledgements
  • Files Transfer
  • Developers
    • Run, build & deploy
    • Spaghetti Code
      • Code Structure
      • System Variables
      • Working with Files
      • Open a program with a file
    • 3rd-party apps
      • Pick Files
      • Save File As
      • Get File
      • Save File
Powered by GitBook
On this page
  1. Developers
  2. Spaghetti Code

System Variables

PreviousCode StructureNextWorking with Files

Last updated 2 years ago

System-wide configurations (file types icons, list of default desktop wallpapers, open with menu, etc.) are set in src/lib/system.js

For data that need to be communicated across the system, win32.run uses . (src/lib/store.js). These data structures allow any page to subscribe and listen to their changes.

Example 1: any page can request to launch a program with

import { queueProgram } from '$lib/store.js'
queueProgram.set(program_details);

src/routes/xp/work_space.svelte listens to these requests and launches the requested program

import { queueProgram } from '$lib/store.js'

queueProgram.subscribe(program_details => {
    if(program_details == null){
        return;
    }
    launch(program_details);
})

Example 2: the hard drive hardDrive (in src/lib/store.js) is also a Svelte Store (actually it's just the inventory of files and folders, the real files' contents are saved in IndexedDB).

Any native program can make updates to win32 hard drive with hardDrive.update(...) or hardDrive.set(...). (Though you should use utilities functions in $lib/fs.js like fs.save_file, fs.del_fs, fs.new_fs_item)

src/routes/xp/programs/my_computer.svelte subscribes to its changes and updates its UI accordingly

Svelte Stores