Class

DuSettings

DuSettings(namespaceopt, fileopt)

A class to manage settings.
Warning: DuESF stores the settings in json files and needs the right to write files, but it does not check if it has write access on the files, you should check that first using methods specific to the host application.
Constructor

# new DuSettings(namespaceopt, fileopt)

Constructs a new DuSettings instance.
Parameters:
Name Type Attributes Default Description
namespace string <optional>
DuESF.scriptName A namespace to group your settings.
file File | string <optional>
Folder.myDocuments/namespace/namespace_settings.json The file to store the settings
Properties:
Name Type Description
namespace string A namespace to group your settings.
file File The file to store the settings
data Object The settings as a js object

View Source DuAEF.jsxinc, line 3010

Methods

# get(key, defaultValueopt) → {*}

Gets a value from the settings. The key can be a path separated by /
Parameters:
Name Type Attributes Default Description
key string The setting to get
defaultValue * <optional>
null The default value if the key is not set in the settings

View Source DuAEF.jsxinc, line 3128

The value
*

# load()

loads data from the settings file

View Source DuAEF.jsxinc, line 3067

# reset()

Reset the settings to their default values (removes the settings file!)

View Source DuAEF.jsxinc, line 3116

# save() → {boolean}

Saves data to the file.
Warning: DuESF does not check if it has write access on the files, you should check that first using methods specific to the host application.

View Source DuAEF.jsxinc, line 3083

true if the file has been correctly written
boolean

# set()

Sets a value to the settings. The key can be a path separated by /
Properties:
Name Type Description
key string The setting to set
value * The value to set

View Source DuAEF.jsxinc, line 3145

# setFile(file)

Sets the file to be used to save the settings
Parameters:
Name Type Description
file File | string The file or path to the file

View Source DuAEF.jsxinc, line 3101