Skip to content

Commit

Permalink
docs: Clear up confusion around where to register proxy services
Browse files Browse the repository at this point in the history
  • Loading branch information
aklinker1 authored Jan 30, 2025
1 parent 4c1ed1a commit 684feda
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/content/proxy-service/0.installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const [registerMathService, getMathService] = defineProxyService(
```ts [background.ts]
import { registerMathService } from './MathService';

// 2. As soon as possible, register it in the background script
// 2. Register the service at the beginning of the background script
registerMathService();
```

Expand Down Expand Up @@ -135,7 +135,7 @@ registerTodosRepo(db);

::

You need to call `register` synchronously at the top level of the background script to avoid race conditions between registering and accessing the service for the first time.
You need to call `register` synchronously at the beginning of the background script to avoid race conditions between registering and accessing the service for the first time.

::alert
Here, even though `openDB` returns a promise, we're not awaiting the promise until executing the functions inside the service.
Expand Down

0 comments on commit 684feda

Please sign in to comment.