electron/lib/browser/api/system-preferences.ts
Samuel Attard e9cb85bea6
build: add import/order eslint rule (#44106)
build: add import/order eslint rule (#44085)

* build: add import/order eslint rule

* chore: run lint:js --fix
2024-10-02 20:52:01 -07:00

23 lines
989 B
TypeScript

import * as deprecate from '@electron/internal/common/deprecate';
const { systemPreferences } = process._linkedBinding('electron_browser_system_preferences');
if ('getEffectiveAppearance' in systemPreferences) {
const nativeEAGetter = systemPreferences.getEffectiveAppearance;
Object.defineProperty(systemPreferences, 'effectiveAppearance', {
get: () => nativeEAGetter.call(systemPreferences)
});
}
if ('accessibilityDisplayShouldReduceTransparency' in systemPreferences) {
const reduceTransparencyDeprecated = deprecate.warnOnce('systemPreferences.accessibilityDisplayShouldReduceTransparency', 'nativeTheme.prefersReducedTransparency');
const nativeReduceTransparency = systemPreferences.accessibilityDisplayShouldReduceTransparency;
Object.defineProperty(systemPreferences, 'accessibilityDisplayShouldReduceTransparency', {
get: () => {
reduceTransparencyDeprecated();
return nativeReduceTransparency;
}
});
}
export default systemPreferences;