Documentation
Reference
2.1.55 (current version)
collection
interactivityModel
Interfaces

vow

Static object.

Contains methods for creating and processing promise objects.

Note. 

This class is a part of the Vow library.

Only some of the methods are described below. The complete list of methods is available here: http://dfilatov.github.io/vow/.

Copyright (c) 2012-2013 Filatov Dmitry (dfilatov@yandex-team.ru). Dual licensed under the MIT and GPL licenses.

Methods

vow()

Methods

NameReturnsDescription
all(iterable)

vow.Promise

Returns a promise object that will be either allowed or denied only if all the specified objects will be accepted or rejected, correspondingly.

defer()

vow.Deferred

Creates a new deferred object. The same as `new ymaps.vow.Deferred()`.

reject(reason)

vow.Promise

Returns a promise object rejected with the specified reason.

resolve(value)

vow.Promise

Returns the promise object which is accepted with the specified value.

Methods details

all

Returns a promise object that will be either allowed or denied only if all the specified objects will be accepted or rejected, correspondingly.

Parameters:

ParameterDefault valueDescription
iterable*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object[][]|Object[]

Set of promise objects and/or values.

* Mandatory parameter/option.

Examples:

1.

var deferred1 = ymaps.vow.defer(),
    deferred2 = ymaps.vow.defer();

ymaps.vow.all([deferred1.promise(), deferred2.promise(), 3])
    .then(function(value) {
         // value => [1, 2, 3]
    });

deferred1.resolve(1);
deferred2.resolve(2);

2.

var deferred1 = ymaps.vow.defer(),
    deferred2 = ymaps.vow.defer();

ymaps.vow.all({ p1 : deferred1.promise(), p2 : deferred2.promise(), p3 : 3 })
    .then(function(value) {
         // value => { p1 : 1, p2 : 2, p3 : 3 }
    });

deferred1.resolve(1);
deferred2.resolve(2);

defer

{vow.Deferred} defer()

Creates a new deferred object. The same as `new ymaps.vow.Deferred()`.

See vow.Deferred

Returns a deferred object.

reject

Returns a promise object rejected with the specified reason.

Parameters:

ParameterDefault valueDescription
reason*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

The reason for rejection.

* Mandatory parameter/option.

resolve

{vow.Promise} resolve(value)

Returns the promise object which is accepted with the specified value.

Parameters:

ParameterDefault valueDescription
value*
[no-highlight[

* Mandatory parameter/option.

]no-highlight]

Type: Object

Value.

* Mandatory parameter/option.