mirror of
https://github.com/microsoft/monaco-editor.git
synced 2025-12-22 11:35:40 +01:00
Use native promises (fixes microsoft/monaco-editor#1766)
This commit is contained in:
parent
2ed113477e
commit
71bbf3f7a5
1 changed files with 3 additions and 5 deletions
|
|
@ -16,7 +16,7 @@
|
|||
require(['vs/editor/editor.main'], function() {
|
||||
var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'));
|
||||
|
||||
monaco.Promise.join([xhr('original.txt'), xhr('modified.txt')]).then(function(r) {
|
||||
Promise.all([xhr('original.txt'), xhr('modified.txt')]).then(function(r) {
|
||||
var originalTxt = r[0].responseText;
|
||||
var modifiedTxt = r[1].responseText;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@
|
|||
<script>
|
||||
function xhr(url) {
|
||||
var req = null;
|
||||
return new monaco.Promise(function(c,e,p) {
|
||||
return new Promise(function(c,e) {
|
||||
req = new XMLHttpRequest();
|
||||
req.onreadystatechange = function () {
|
||||
if (req._canceled) { return; }
|
||||
|
|
@ -42,8 +42,6 @@
|
|||
e(req);
|
||||
}
|
||||
req.onreadystatechange = function () { };
|
||||
} else {
|
||||
p(req);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -58,4 +56,4 @@
|
|||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue