## 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 Duik_api_fordoc.jsxinc, line 3024

# 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 Duik_api_fordoc.jsxinc, line 3142

Returns:
The value
Type: `*`

#### # load()

loads data from the settings file

View Source Duik_api_fordoc.jsxinc, line 3081

#### # reset()

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

View Source Duik_api_fordoc.jsxinc, line 3130

#### # 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 Duik_api_fordoc.jsxinc, line 3097

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 Duik_api_fordoc.jsxinc, line 3159

#### # 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 Duik_api_fordoc.jsxinc, line 3115