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

# ready

Static function.

Performs the passed function when the API and DOM are ready for use.

**Returns** the promise object that is verified by the API namespace, or rejected if an error occurred when loading.

```javascript
{ vow.Promise } ready([successCallback[, errorCallback[, context]]])
```

**Parameters:**

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

Function that will be called after successfully loading and initializing the API and DOM, or an object with parameters if the extended syntax is used.

Available parameters:

- require — Array of additional modules that must be loaded with the API.
- successCallback - Function that will be called when the API is loaded successfully.
- errorCallback - Function that will be called if an error occurs.
- context - Execution context for functions.

All parameters are optional.

The API namespace will be passed to successCallback. ||
|| [`errorCallback`](#param-errorCallback) | — | Type: Function

The function that will be called if an error occurred during initialization. The error will be passed to the function. ||
|| [`context`](#param-context) | — | Type: Object

Context for the function. ||
|#


**Examples:**

**1.**

```javascript
<!DOCTYPE html>
<html>
<head>
    <title>Example</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    
</head>
<body>
    <div id="map" style="width: 500px; height: 500px;"></div>
</body>
</html>
```

**2.**

```javascript
// Example using the extended syntax.
ymaps.ready({
    // successCallback will be called when the API and the "myModule1" module are loaded.
    require: ['myModule1'],
    successCallback: function (ym) {
        var map = new ymaps.Map('map', {
            center: [55.7, 37.6],
            zoom: 10
        });
        var obj = new ymaps.myModule1();
        // ...
    }
})
```
