mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 17:25:39 +01:00
Merge pull request #3583 from madcodelife/main
Fix 'Hover Provider Example' incorrect Promise syntax
This commit is contained in:
commit
3b800d8192
1 changed files with 25 additions and 28 deletions
|
|
@ -31,8 +31,7 @@ monaco.editor.create(document.getElementById("container"), {
|
||||||
|
|
||||||
function xhr(url) {
|
function xhr(url) {
|
||||||
var req = null;
|
var req = null;
|
||||||
return new Promise(
|
return new Promise(function (c, e) {
|
||||||
function (c, e) {
|
|
||||||
req = new XMLHttpRequest();
|
req = new XMLHttpRequest();
|
||||||
req.onreadystatechange = function () {
|
req.onreadystatechange = function () {
|
||||||
if (req._canceled) {
|
if (req._canceled) {
|
||||||
|
|
@ -56,10 +55,8 @@ function xhr(url) {
|
||||||
req.responseType = "";
|
req.responseType = "";
|
||||||
|
|
||||||
req.send(null);
|
req.send(null);
|
||||||
},
|
}).catch(function () {
|
||||||
function () {
|
|
||||||
req._canceled = true;
|
req._canceled = true;
|
||||||
req.abort();
|
req.abort();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue