## 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_Duik_api.jsxinc, line 2985

# Methods

#### # get() → {*}

Gets a value from the settings. The key can be a path separated by /

##### Properties:

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_Duik_api.jsxinc, line 3103

Returns:
The value
Type: `*`

#### # load()

loads data from the settings file

View Source DuAEF_Duik_api.jsxinc, line 3042

#### # reset()

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

View Source DuAEF_Duik_api.jsxinc, line 3091

#### # 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_Duik_api.jsxinc, line 3058

Returns:
true if the file has been correctly written
Type: `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_Duik_api.jsxinc, line 3120

#### # 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_Duik_api.jsxinc, line 3076