@isoloop/devtools
connectDevtools
Experimental
Connects the devtools panel: a surface covering the viewport that takes no
pointer events itself (the panel's boxes are position: fixed), and the
panel isolate in its own worker with the inspect grant (never pooled).
The floating button and Alt+Shift+D (Option+Shift+D on a Mac) open and
close it. Nothing keeps it out of a production build: leave the call out of
production code yourself.
function connectDevtools(kernel: Kernel, o?: DevtoolsOptions): () => Promise<void>;
| Parameter | Description |
|---|---|
kernel |
The kernel to inspect. |
o |
Where the panel sits, how its button shows health, and the panel's module and id. Default: all defaults. |
Returns: A function that disconnects: it stops the panel isolate and removes its surface, resolving once the worker is gone.
Throws:
- {Error} When an isolate with the panel's
idalready exists, for example a secondconnectDevtoolsbefore the first disconnects. - {KernelError}
bus_failedwhen the bus failed to load its contracts.
Example:
import { connectDevtools } from '@isoloop/devtools';
const disconnect = connectDevtools(kernel, { position: 'bottom-left' });
Guides: Devtools panel.
DevtoolsOptions
Experimental
The options of connectDevtools: where the panel sits, how its button shows health, and the panel's module and id.
type DevtoolsOptions = {
src?: string;
position?: DevtoolsPosition;
healthStatus?: HealthStatus;
id?: string;
};
| Field | Description |
|---|---|
src? |
The panel isolate's module URL. Defaults to the panel.js next to this module in the published package, which @isoloop/vite serves in dev and Vite emits in a build. With another bundler, pass the URL it serves @isoloop/devtools/panel at. |
position? |
Where the closed button and the opened panel sit. Default 'bottom-right'. |
healthStatus? |
How the closed button shows the kernel's health. Default 'ring'. |
id? |
The panel isolate's id in the kernel. Default 'isoloop-devtools'. |
Guides: Devtools panel.
DevtoolsPosition
Experimental
The corner the floating button and the docked panel sit in.
type DevtoolsPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
Guides: Devtools panel.
HealthStatus
Experimental
How the closed button shows the kernel's health:
'ring': a ring of twelve arcs, one stretch of isolates each, coloured by their worst state, with a wave of brightness running round it;'radar': the same ring, with the logo filled by the same twelve colours;'off': a plain white ring, with no status on the button.
type HealthStatus = "ring" | "radar" | "off";
Guides: Devtools panel.