-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |