util.bind

Alert

This function is deprecated. Use native Function.bind method.

Static function.

Binds the passed function to the passed context.

Returns a copy of the given function with the specified this value.

{ Function } util.bind(callback, context)

Parameters:

Parameter

Default value

Description

callback*

ā€”

Type: Function

Function.

context*

ā€”

Type: Object

Execution context.

* Mandatory parameter/option.

Example:

var myObject = {
    name: 'test!'
};
ymaps.geocode.load('Moscow')
    then(ymaps.util.bind(function (res) {
        alert(this.name); // test!
    }, myObject));