MCPcopy Create free account
hub / github.com/Roy3838/Observer / initPlatformFetch

Function initPlatformFetch

app/src/utils/platform.ts:203–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

201 * Call this at app startup to pre-load the Tauri HTTP plugin.
202 */
203export const initPlatformFetch = async (): Promise<void> => {
204 if (!isDesktop()) return;
205
206 if (tauriFetchLoading) {
207 await tauriFetchLoading;
208 return;
209 }
210
211 tauriFetchLoading = (async () => {
212 try {
213 const { fetch } = await import('@tauri-apps/plugin-http');
214 tauriFetchFn = fetch;
215 Logger.info('platform', 'Tauri HTTP plugin loaded for desktop localhost requests');
216 } catch (err) {
217 console.warn('[Platform] Failed to load Tauri HTTP plugin:', err);
218 }
219 })();
220
221 await tauriFetchLoading;
222};
223
224/**
225 * Platform-aware fetch for local/private network requests.

Callers 1

main.tsxFile · 0.90

Calls 3

isDesktopFunction · 0.85
infoMethod · 0.80
warnMethod · 0.80

Tested by

no test coverage detected