Skip to content

ElectronSystemPreferences.setUserDefault method

ElectronSystemPreferences › setUserDefault

Unofficial

Sets the value of key in NSUserDefaults. Note that type should match the actual type of value. An exception is thrown if they don't.

Signature:

setUserDefault(key: string, type: Type, value: ElectronUserDefaultTypes[Type]): void

Parameters:

ParameterTypeDescription
keystringThe NSUserDefaults key to write.
typeTypeThe type of the value being stored.
valueElectronUserDefaultTypes[Type]The value to store.

Platform: darwin.

Returns: void