You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/kit/rpc.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -393,6 +393,22 @@ export default function setup(ctx: DockClientScriptContext) {
393
393
}
394
394
```
395
395
396
+
### Global Client Context
397
+
398
+
Use `getDevToolsClientContext()` to access the client context (`DevToolsClientContext`) from anywhere on the client side. This is set automatically when DevTools initializes in embedded or standalone mode.
Copy file name to clipboardExpand all lines: skills/vite-devtools-kit/SKILL.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -360,6 +360,19 @@ export default function setup(ctx: DevToolsClientScriptContext) {
360
360
}
361
361
```
362
362
363
+
## Client Context
364
+
365
+
The global client context (`DevToolsClientContext`) provides access to the RPC client and is set automatically when DevTools initializes (embedded or standalone). Use `getDevToolsClientContext()` to access it from anywhere on the client side:
Copy file name to clipboardExpand all lines: skills/vite-devtools-kit/references/rpc-patterns.md
+15Lines changed: 15 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,21 @@ ctx.rpc.broadcast({
119
119
})
120
120
```
121
121
122
+
## Global Client Context
123
+
124
+
Use `getDevToolsClientContext()` to access the client context (`DevToolsClientContext`) globally. Returns `undefined` if the context has not been initialized yet.
This is set automatically when DevTools initializes in embedded or standalone mode. For iframe pages, `getDevToolsRpcClient()` is still the recommended way to get the RPC client directly.
0 commit comments