Docs Reference
Alpha documentation — APIs may change between 0.x releases.

Runtime events

The runtime contract contains host-level events that are not owned by a native capability module.

runtime.onHotReloaded

Emitted after the .NET runtime applies a supported C# hot-reload update.

import { runtime } from "@vidra-dev/sdk";

const unsubscribe = runtime.onHotReloaded((update) => {
  const names = update.updatedTypes.map((name) => name.split(".").pop());
  console.log("C# reloaded:", names.join(", "));
});

Payload:

interface HotReloadedPayload {
  updatedTypes: string[];
}

Use this event when the web UI needs to re-query native state or display development feedback after a C# edit. It is a development signal; application logic should not depend on it in production.

Return or call the generated unsubscribe function when the component unmounts:

useEffect(() => {
  return runtime.onHotReloaded(() => {
    void refreshNativeState();
  });
}, []);

For module-owned events, see Built-in native capabilities and MAUI Essentials. To define an app event, read Send events to JavaScript.