JSFiddle - React, Tailwind, and code Playground

by abarykin

HTML

<script type="text/javascript" src="https://api-maps.yandex.ru/2.1/?lang=ru_RU"></script>
<div id="map"></div>

CSS

html, body, #map {
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
}

JavaScript

function init() {
    var myMap = new ymaps.Map('map', {
        center: [55.73197, 49.18978],
        zoom: 13,
        controls: ["zoomControl", "rulerControl", "searchControl"]
    });

    routeEditor = new ymaps.control.RouteEditor();
    myMap.controls.add(routeEditor);


    this.routeEditor.events.add('deselect', function () {
        var route = routeEditor.getRoute();
        var info;
        info = "Длина маршрута - " + route.getLength() + " м\nВремя в пути - " + route.getHumanTime();
        info = info.replace(/&#160;/img, '');
        //alert(info);

        route.events.add('update', function () {
            info = "Длина маршрута - " + route.getLength() + " м\nВремя в пути - " + route.getHumanTime();
            info = info.replace(/&#160;/img, '');
            console.log(info);

        });
    });
}

ymaps.ready(init);