devtoolsReport
Reports one event to the devtools hook (globalThis.__SHADOWJS_DEVTOOLS_HOOK__, protocol version 1) when one is installed.
Reports one event to the devtools hook (globalThis.__SHADOWJS_DEVTOOLS_HOOK__, protocol version
- when one is installed. Does nothing without a hook, with a hook of another version, and in
production builds. Exported from
@shadow-js/core/extendasdevtoolsReport. Pass the runtime's own objects, not copies, so a report allocates nothing.
Import#
ts
import { devtoolsReport } from "@shadow-js/core/extend";
Signature#
ts
function report(
kind: number,
a?: unknown,
b?: unknown,
c?: unknown,
d?: unknown,
e?: unknown,
): void
Parameters#
| Name | Description |
|---|---|
kind |
The event kind, one of DEVTOOLS_EVENT. |
a |
First argument of the event (see the protocol table of the devtools README). |
b |
Second argument of the event, or undefined when the kind has none. |
c |
Third argument of the event, or undefined when the kind has none. |
d |
Fourth argument of the event, or undefined when the kind has none. |
e |
Fifth argument of the event, or undefined when the kind has none. |
Examples#
ts
import { isDev } from "@shadow-js/core";
import { currentOwner, DEVTOOLS_EVENT, devtoolsReport } from "@shadow-js/core/extend";
function reportFailure(error: unknown): void {
if (isDev) devtoolsReport(DEVTOOLS_EVENT.ERROR, currentOwner(), error, undefined);
}