---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/option.Manager.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt

# option.Manager

Extends [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md).

Options manager. For setting and getting option values by a string key, as well as allowing option values in the context of the existing hierarchy of options managers.

The special "preset" key is for making a set of options by default for this manager. The value of the "preset" option can be a hash with the format {"option name": "option value"}, or a string ID for a hash of options in the [option.presetStorage](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.presetStorage.md) storage. This hash of options can also contain a field named "preset", which allows for inheritance of option values from other sets of options.

When searching for values in the hierarchy, first the options themselves are checked, then the options set using the "preset" key, and after that the parent is accessed, if there is one.

To track changes to certain options, you can use [Monitor](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Monitor.md).

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
option.Manager([options[, parent[, name]]])
```

Creates an options manager.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`options`](#param-options) | — | Type: Object

Hash of options. ||
|| [`parent`](#param-parent) | — | Type: [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)

Parent options manager. ||
|| [`name`](#param-name) | — | Type: String

Name of the options manager. ||
|#


**Examples:**

**1.**

```javascript
// Example of building a hierarchy of options managers.
var parentManager = new ymaps.option.Manager({
    key1: '123'
});
var childManager = new ymaps.option.Manager({
    key2: '234'
}, parentManager);
// Outputs 123. The value is taken from manager1.
alert(childManager.get('key1'));
// Outputs 234. The value is taken from manager2.
alert(childManager.get('key2'));
// Overriding the option.
childManager.set('key1', '345');
// Outputs 345. The value is taken from manager2.
alert(childManager.get('key1'));
// Outputs 123. The value is taken from manager1.
alert(parentManager.get('key1'));
```

**2.**

```javascript
// Example using the "preset" option.
var optionManager = new ymaps.option.Manager({
    preset: 'islands#blueIcon'
});
var subOptionManager = new ymaps.option.Manager();
// There is no data, because subOptionManager is empty.
alert(subOptionManager.get('iconImageSize');
// Binding two managers.
subOptionManager.setParent(optionManager);
// [37, 42] - value is taken from the preset in the parent manager.
alert(subOptionManager.get('iconImageSize');
// Overriding the value of iconImageSize on the level of subOptionManager.
subOptionManager.set('iconImageSize', [10, 12]);
// [10, 12] - value is taken from subOptionManager.
alert(subOptionManager.get('iconImageSize');
// Canceling the override of iconImageSize.
subOptionManager.unset('iconImageSize');
// [37, 42] - value is again taken from the preset in the parent manager.
alert(subOptionManager.get('iconImageSize'));
```

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md) | Event manager for the object.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#events). ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [change](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#event-change) | Changes occurred either in the options values, or in the options inheritance hierarchy. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class. ||
|| [parentchange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChild.md#event-parentchange) | The parent object reference changed.

Data fields:

- oldParent - Old parent.
- newParent - New parent.

Inherited from [IChild](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChild.md#event-parentchange). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [freeze](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze)() | [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md) | Switches the object to "frozen" mode.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#freeze). ||
|| [get](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#get)([key](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#get-param-key)[, [defaultValue](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#get-param-defaultValue)]) | | Returns the value of the specified option in the context of the existing options inheritance hierarchy. When this method is called, first values are searched for in the current options manager, then, if the value is not defined, the search continues in the hierarchy of parent managers.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#get). ||
|| [getAll](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getAll)() | Object | Returns a reference to the internal hash that stores option values.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getAll). ||
|| [getName](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getName)() | String | Returns name of the options manager.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getName). ||
|| [getNative](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getNative)([key](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getNative-param-key)) | Object | Returns the value of the specified option that is defined for the given level of the options hierarchy, i.e. in this manager.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getNative). ||
|| [getParent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getParent)() | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md)\|null | Returns parent options manager.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#getParent). ||
|| [isFrozen](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen)() | Boolean | Returns true if the object is in "frozen" mode, otherwise false.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#isFrozen). ||
|| [resolve](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#resolve)([key](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#resolve-param-key)[, [name](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#resolve-param-name)]) | Object | Method intended to be called by child options managers.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#resolve). ||
|| [set](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#set)([key](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#set-param-key)[, [value](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#set-param-value)]) | [option.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md) | Sets option values for this manager. Two signatures are supported: 
- A single argument consisting of a hash in the format {"option name": "option value"}.
- Two arguments, the first of which is the option name, and the second is the value. ||
|| [setName](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setName)([name](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setName-param-name)) | | Sets the name of the options manager.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setName). ||
|| [setParent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setParent)([parent](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setParent-param-parent)) | [IChild](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IChild.md) | Sets the parent options manager.

Inherited from [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md#setParent). ||
|| [unfreeze](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze)() | [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md) | Switches the object to active mode.

Inherited from [IFreezable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IFreezable.md#unfreeze). ||
|| [unset](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#unset)([keys](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#unset-param-keys)) | [option.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md) | Clears the values for the set options in this manager. ||
|| [unsetAll](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md#unsetAll)() | [option.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/option.Manager.md) | Clears the values for all options in this manager. ||
|#

## Events details {#event_detail}

### change {#change}

Changes occurred either in the options values, or in the options inheritance hierarchy. Instance of the [Event](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Event.md) class.

## Methods details {#method_detail}

### set {#set}

```javascript
{option.Manager} set(key[, value])
```

Sets option values for this manager. Two signatures are supported: 
- A single argument consisting of a hash in the format {"option name": "option value"}.
- Two arguments, the first of which is the option name, and the second is the value.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`key`](#set-param-key)[*](*star) | — | Type: Object\|String

The option name, or a hash in the format {"option name": "option value"}. ||
|| [`value`](#set-param-value) | — | Type: Object

The option value, if the name was passed as the first argument. ||
|#

\* Mandatory parameter/option.

**Examples:**

**1.**

```javascript
// Setting multiple options via hash.
myMap.options.set({
    dblClickZoomCentering: true,
    dblClickFloatZoom: true
});
// Generates a single event option.Manager.event:change.
```

**2.**

```javascript
// Setting options separately.
myMap.options
    .set("dblClickZoomCentering", true)
    .set("dblClickFloatZoom", true);
// Gernerates the event option.Manager.event:change.
```

**3.**

```javascript
// Using "freeze" to minimize the number of option.Manager.event:change events.
myMap.options.freeze();
myMap.options.set({
    dblClickZoomCentering: true,
    dblClickFloatZoom: true
});
myMap.options.set('cursor', 'zoom');
myMap.unfreeze();
// Generates a single option.Manager.event:change event.
```

### unset {#unset}

```javascript
{option.Manager} unset(keys)
```

Clears the values for the set options in this manager.

**Returns** self-reference.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`keys`](#unset-param-keys)[*](*star) | — | Type: String\|String[]

Option name or array of option names whose values should be canceled. ||
|#

\* Mandatory parameter/option.

**Example:**

```javascript
map.options.unset(['dblClickZoomCentering', 'dblClickFloatZoom']);
```

### unsetAll {#unsetAll}

```javascript
{option.Manager} unsetAll()
```

Clears the values for all options in this manager.

**Returns** self-reference.

**Example:**

```javascript
var geoObject = new ymaps.Placemark([37, 55], {}, {preset:'islands#blueIcon'});
myMap.geoObjects.add(geoObject);
// Changing the style however we want.
geoObject.options.set({
    iconLayout: 'default#image',
    iconImageHref: 'http://mysite.ru/icon.png',
    iconImageSize: [16, 16]
});
// Restoring the initial appearance.
geoObject.options
    // To avoid a double reaction of the geo object
    // to the option changes, first we call "freeze", then after
    // setting all values, we call "unfreeze".
    .freeze()
    .unsetAll()
    .set('preset','islands#blueIcon')
    .unfreeze();
```

[*star]: Mandatory parameter/option.