Reading Settings
App Settings
Method 1: Using API
const settings = api.nexomaker.getAppSettings();
const apiKey = settings['api-key'] || '';
const enabled = settings['enable-feature'] || false;Method 2: Direct localStorage
const settingsJson = localStorage.getItem('app-settings');
const settings = JSON.parse(settingsJson || '{}');
const apiKey = settings['api-key'] || '';Method 3: Event Listener
window.addEventListener('app-settings-changed', (event) => {
const { settings } = event.detail;
console.log('Settings updated:', settings);
// React to specific changes
if (settings['enable-auto-sync']) {
startAutoSync(settings['sync-interval']);
} else {
stopAutoSync();
}
});Project Settings
Reading from YAML
Reading from Different YAML Keys
Best Practices
1. Always Provide Fallback Values
2. Use Consistent Key Names
3. Handle Async Operations
4. Cache Settings When Appropriate
5. Listen for Changes
Common Patterns
Initialize on Load
Project-Specific Logic
Combining App and Project Settings
Conditional Feature Activation
Examples
Simple App Settings
Project Settings with Validation
Troubleshooting
Settings Return Undefined
Changes Don't Reflect
Async Issues
Next Steps
Last updated