Skip to content

Commit

Permalink
Merge pull request #1 from arduino/persitence
Browse files Browse the repository at this point in the history
Save settings to local storage
  • Loading branch information
sebromero authored Dec 12, 2024
2 parents 6913c4d + e74b1a8 commit b138bf0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Follow the on-screen prompts to download and install the MicroPython firmware.
- Arduino Nano ESP32
- Arduino Nano 33 BLE

**Note:** This tool may work for 3rd party boards too. This is however not officially supported.

## ⚙️ Installation

You can download the binary for your operating system from the [release page](https://github.com/arduino/lab-micropython-package-installer/releases).
Expand Down
14 changes: 14 additions & 0 deletions renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,20 @@ document.addEventListener('DOMContentLoaded', async () => {
// Show loading spinner
packageList.innerHTML = '<div class="loading-spinner primary" style="margin: 50px auto;"></div>';

// Load initial state of the checkboxes from local storage
compileFilesCheckbox.checked = localStorage.getItem('compileFiles') === 'true';
overwriteExistingCheckbox.checked = localStorage.getItem('overwriteExisting') === 'true';

compileFilesCheckbox.addEventListener('change', () => {
// Persist the user's selection in local storage
localStorage.setItem('compileFiles', compileFilesCheckbox.checked);
});

overwriteExistingCheckbox.addEventListener('change', () => {
// Persist the user's selection in local storage
localStorage.setItem('overwriteExisting', overwriteExistingCheckbox.checked);
});

deviceSelectionList.addEventListener("device-selected", (event) => {
selectedDeviceItem = event.target;
console.log("Selected device item:", selectedDeviceItem);
Expand Down

0 comments on commit b138bf0

Please sign in to comment.