ソースを参照

Use native promises (fixes microsoft/monaco-editor#1766)

Alexandru Dima 5 年 前
コミット
71bbf3f7a5
1 ファイル変更3 行追加5 行削除
  1. 3 5
      browser-amd-diff-editor/index.html

+ 3 - 5
browser-amd-diff-editor/index.html

@@ -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>