Skip to content

Commit

Permalink
Create accessibilityOptions.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Dec 3, 2024
1 parent 5c12666 commit bbd404c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions src/customization/accessibilityOptions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// accessibilityOptions.js

class AccessibilityOptions {
constructor() {
this.userAccessibilitySettings = {}; // Store accessibility settings by user ID
}

// Set accessibility options for a user
setAccessibilityOptions(userId, options) {
this.userAccessibilitySettings[userId] = options;
console.log(`Accessibility options set for user ${userId}:`, options);
return options;
}

// Get accessibility options for a user
getAccessibilityOptions(userId) {
return this.userAccessibilitySettings[userId] || this.getDefaultAccessibilityOptions();
}

// Reset accessibility options to default
resetAccessibilityOptions(userId) {
this.userAccessibilitySettings[userId] = this.getDefaultAccessibilityOptions();
console.log(`Accessibility options reset to default for user ${userId}`);
return this.userAccessibilitySettings[userId];
}

// Get default accessibility options
getDefaultAccessibilityOptions() {
return {
textToSpeech: false,
highContrast: false,
keyboardNavigation: true,
fontSize: 'medium',
};
}
}

// Example usage
const accessibilityManager = new AccessibilityOptions();
accessibilityManager.setAccessibilityOptions('user123', { textToSpeech: true, highContrast: true, keyboardNavigation: true, fontSize: 'large' });
const userAccessibility = accessibilityManager.getAccessibilityOptions('user123');
console.log('User Accessibility Options for user123:', userAccessibility);

accessibilityManager.resetAccessibilityOptions('user123');
const defaultAccessibility = accessibilityManager.getAccessibilityOptions('user123');
console.log('Default Accessibility Options for user123:', defaultAccessibility);

export default AccessibilityOptions;

0 comments on commit bbd404c

Please sign in to comment.