diff options
| author | tamaina <tamaina@hotmail.co.jp> | 2021-09-21 19:45:07 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-21 19:45:07 +0900 |
| commit | b7fd9e8c55fcee854388e2450dd67c45343d79be (patch) | |
| tree | 91290176f2477577ebdad809d5b6ae1d86c78445 | |
| parent | fix: Notificationsの型を修正 (#27) (diff) | |
| download | misskey-b7fd9e8c55fcee854388e2450dd67c45343d79be.tar.gz misskey-b7fd9e8c55fcee854388e2450dd67c45343d79be.tar.bz2 misskey-b7fd9e8c55fcee854388e2450dd67c45343d79be.zip | |
fix: apiでネイティブfetchを格納する際に無名関数でラップするように (#29)
* fix fetch
* add comment
* 表現を変更
| -rw-r--r-- | src/api.ts | 4 |
1 files changed, 3 insertions, 1 deletions
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<E extends keyof Endpoints, P extends Endpoints[E]['req']>( |