Fix 'Hover Provider Example' incorrect Promise syntax

This commit is contained in:
Floyd Wang 2023-02-22 17:43:23 +08:00
parent 2f556e3f9d
commit 0b9f3c15d2

View file

@ -31,8 +31,7 @@ monaco.editor.create(document.getElementById("container"), {
function xhr(url) {
var req = null;
return new Promise(
function (c, e) {
return new Promise(function (c, e) {
req = new XMLHttpRequest();
req.onreadystatechange = function () {
if (req._canceled) {
@ -56,10 +55,8 @@ function xhr(url) {
req.responseType = "";
req.send(null);
},
function () {
}).catch(function () {
req._canceled = true;
req.abort();
}
);
});
}