Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save settings to local storage #1

Merged
merged 2 commits into from
Dec 12, 2024
Merged
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
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
Loading