App Settings

App Settings are application-wide settings that apply globally across all projects. They are stored in localStorage under the key app-settings.


Overview

Storage Location

  • Storage: localStorage['app-settings']

  • Format: JSON object with key-value pairs

  • Persistence: Persists across sessions

  • Scope: Global to the application


When to Use App Settings

Use App Settings for:

  • API keys and credentials

  • Global preferences (theme, language, etc.)

  • Application behavior settings

  • License keys

  • Update preferences

  • User-wide configurations

Don't Use App Settings for:

  • Project-specific configuration

  • Per-project data

  • Temporary state

  • Session-specific data


Creating App Settings

Basic Example

Complete Example


Reading App Settings

Method 1: Using API

Method 2: Direct localStorage Access

Method 3: Event Listener

Listen for real-time changes:


Best Practices

1. Always Provide Defaults

2. Use Descriptive IDs

3. Add Helpful Descriptions

4. Validate Inputs


Common Patterns

API Configuration

User Preferences

Feature Toggles


Troubleshooting

Settings Not Persisting

Problem: Settings reset when app restarts.

Solutions:

  1. Check that localStorage is accessible

  2. Verify browser doesn't clear localStorage on exit

  3. Check for errors in browser console

  4. Ensure element IDs match when reading

Settings Not Updating

Problem: Changes don't reflect immediately.

Solutions:

  1. Use the app-settings-changed event listener

  2. Check that you're reading the latest settings

  3. Verify the correct key is being used


Next Steps

  • Learn about Element Types →

  • See complete examples →

  • Read about best practices →

Last updated