From b7fd9e8c55fcee854388e2450dd67c45343d79be Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 21 Sep 2021 19:45:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20api=E3=81=A7=E3=83=8D=E3=82=A4=E3=83=86?= =?UTF-8?q?=E3=82=A3=E3=83=96fetch=E3=82=92=E6=A0=BC=E7=B4=8D=E3=81=99?= =?UTF-8?q?=E3=82=8B=E9=9A=9B=E3=81=AB=E7=84=A1=E5=90=8D=E9=96=A2=E6=95=B0?= =?UTF-8?q?=E3=81=A7=E3=83=A9=E3=83=83=E3=83=97=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20(#29)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix fetch * add comment * 表現を変更 --- src/api.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/api.ts b/src/api.ts index 12f5a0b21..33f6e7b69 100644 --- a/src/api.ts +++ b/src/api.ts @@ -46,7 +46,9 @@ export class APIClient { }) { this.origin = opts.origin; this.credential = opts.credential; - this.fetch = opts.fetch || fetch; + // ネイティブ関数をそのまま変数に代入して使おうとするとChromiumではIllegal invocationエラーが発生するため、 + // 環境で実装されているfetchを使う場合は無名関数でラップして使用する + this.fetch = opts.fetch || ((...args) => fetch(...args)); } public request(