Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

PrefHandler

dangered wolf edited this page Mar 27, 2022 · 2 revisions

Preference Management in PrefHandler.js

ModernDeck includes functions to help deal with the storage of simple key/value preferences.

It abstracts platform differences this way and provides a simple interface.

For example, while the browser extensions rely on localStorage, the Electron app relies on an electron-store called "mtdsettings".

function getPref(String key, [variousTypes] default)

Returns the saved preference with the specified key. If the preference has not been set before, it will return undefined.

function setPref(String key, [variousTypes] value)

Sets the preference with the key key to value.

Valid types for preference values can be String, number, boolean, or undefined to clear it.

function hasPref(String key)

Returns boolean; true if the preference storage system has a value for the key key, or false if it does not.

function purgePrefs()

Clears all ModernDeck preferences, while leaving Twitter login intact.