瀏覽代碼

fix test error (ajax)

sschmid 4 年之前
父節點
當前提交
bb528577db
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/OpenSheetMusicDisplay/AJAX.ts

+ 1 - 1
src/OpenSheetMusicDisplay/AJAX.ts

@@ -9,7 +9,6 @@ export class AJAX {
      */
      */
     public static ajax(url: string, timeout: number = 9000): Promise<string> {
     public static ajax(url: string, timeout: number = 9000): Promise<string> {
         let xhttp: XMLHttpRequest;
         let xhttp: XMLHttpRequest;
-        xhttp.timeout = timeout;
         const mimeType: string = url.indexOf(".mxl") > -1 ? "text/plain; charset=x-user-defined" : "application/xml";
         const mimeType: string = url.indexOf(".mxl") > -1 ? "text/plain; charset=x-user-defined" : "application/xml";
         if (XMLHttpRequest) {
         if (XMLHttpRequest) {
             xhttp = new XMLHttpRequest();
             xhttp = new XMLHttpRequest();
@@ -19,6 +18,7 @@ export class AJAX {
         } else {
         } else {
             return Promise.reject(new Error("XMLHttp not supported."));
             return Promise.reject(new Error("XMLHttp not supported."));
         }
         }
+        xhttp.timeout = timeout;
         return new Promise((resolve: (value: string) => void, reject: (error: any) => void) => {
         return new Promise((resolve: (value: string) => void, reject: (error: any) => void) => {
             xhttp.onreadystatechange = () => {
             xhttp.onreadystatechange = () => {
                 if (xhttp.readyState === XMLHttpRequest.DONE) {
                 if (xhttp.readyState === XMLHttpRequest.DONE) {