blob: f3fef9e0030a32cb173f0923997d202c9ec69076 [file] [log] [blame] [raw]
"use strict";
var Promise = require('es6-promise').Promise,
_loaded = false,
_loadPromise = null;
// Returns promise that will be fulfilled when monaco is available
var waitForMonaco = function() {
if (_loadPromise) {
return _loadPromise;
}
_loadPromise = new Promise(function(resolve, reject) {
if (typeof(window.monaco) === 'object') {
resolve(window.monaco);
return window.monaco;
}
window.require(['vs/editor/editor.main'], function() {
_loaded = true;
resolve(window.monaco);
});
});
return _loadPromise;
};
module.exports = waitForMonaco;