-
Couldn't load subscription status.
- Fork 142
Add custom fetch for Electron #218
base: main
Are you sure you want to change the base?
Conversation
The default fetch method is restricted by the browser context in which the app runs. This means that all requests are subjected to CORS and other web security mechanisms. This can sometimes be a pain, so this library now uses node-fetch in Electron contexts.
electron/src/index.ts
Outdated
| }; | ||
|
|
||
| class FetchHelper { | ||
| private static _responses = new Map<string, Response>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is important that _getResponse (getBuffer, getText, getJson, getBlob) gets called; otherwise there could be a memory leak... The client side library will always do this, but this function is also exported to be used separately...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1718da7 should remediate somewhat
|
Wow! This looks excellent. When I get some time, I'll test, approve, and merge it into the v1 branch. Thanks for your contribution 😄 |
- Added 'dispose' method(s) - Added FinalizationRegistry
|
Any updates on this ? |
The default fetch method is restricted by the browser context in which the app runs. This means that all requests are subjected to CORS and other web security mechanisms. This can sometimes be a pain, so with this pull-request this library now uses node-fetch in Electron contexts.