From bfb2ec2172b1ac454b01c995b62b0564b7f56e6d Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sun, 2 Nov 2025 14:58:28 +0100 Subject: [PATCH] Fix fetch binding issue in browser environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed error: "'fetch' called on an object that does not implement interface Window" The fetch function reference was not properly bound to the global context. Now using globalThis.fetch.bind(globalThis) to ensure correct binding. Bumped version to 0.0.2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- package.json | 2 +- src/client.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 92c82e2..1c21393 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xtr-dev/rondevu-client", - "version": "0.0.1", + "version": "0.0.2", "description": "TypeScript client for Rondevu peer signaling and discovery server", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/client.ts b/src/client.ts index bd61004..6c8f5f2 100644 --- a/src/client.ts +++ b/src/client.ts @@ -29,7 +29,7 @@ export class RondevuClient { constructor(options: RondevuClientOptions) { this.baseUrl = options.baseUrl.replace(/\/$/, ''); // Remove trailing slash this.origin = options.origin || new URL(this.baseUrl).origin; - this.fetchImpl = options.fetch || fetch; + this.fetchImpl = options.fetch || globalThis.fetch.bind(globalThis); } /**