From b7fd9e8c55fcee854388e2450dd67c45343d79be Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 21 Sep 2021 19:45:07 +0900 Subject: fix: apiでネイティブfetchを格納する際に無名関数でラップするように (#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 12f5a0b21c..33f6e7b690 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( -- cgit v1.2.3-freya