Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getYandexMapScript() {
- return new Promise(function(resolve, reject){
- if (window.ymapsReady && !window.ymapsLoading) { return resolve(); }
- if (!window.ymapsReady) {
- var ymapsChecker = setInterval(function(){
- if (window.ymapsReady) {
- console.log(window.ymapsReady);
- clearInterval(ymapsChecker);
- return resolve();
- }
- }, 200);
- }
- window.ymapsLoading = true;
- $.cachedScript('https://api-maps.yandex.ru/2.1/?lang=ru_RU')
- .done(function () {
- ymaps.ready(function(){
- window.ymapsReady = true;
- });
- })
- .fail(function(){
- return reject();
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement