BnHostEvents
Namespace: BlazorNative.Core
The host-event names the shells send, so app code names an event rather than spelling it. Two tiers: RESERVED names (BnHostEvents.Back, BnHostEvents.Navigate, BnHostEvents.SafeAreaChanged) are intercepted by the runtime and never reach subscribers; the rest are the names an app can actually subscribe to. See each constant's remarks for which tier it is in.
public static class BnHostEvents
Inheritance Object → BnHostEvents
Attributes NullableContextAttribute, NullableAttribute
Remarks:
HAND-WRITTEN AND PINNED, NOT GENERATED. This is public API with a
PublicAPI baseline; a generator able to rewrite it is a generator able to move
a frozen surface. TheHostEventConstants_MatchTheManifest_BothWays asserts
it against src/wire-vocabulary.json in both directions instead — the same
trade BlazorNativeNodeType makes.
Adding a name here alone does nothing: the shells send what the manifest says. Add it to the manifest, regenerate, then add the constant.
Fields
Back
The user pressed system back. RESERVED — the runtime intercepts this and routes it to the navigation manager; it does not reach subscribers.
public static string Back;
Navigate
A deep link or notification tap asks for a route, carried as the payload. RESERVED — the runtime intercepts this and navigates.
public static string Navigate;
SafeAreaChanged
The area of the display obscured by system UI changed — rotation, a
keyboard, a call banner. RESERVED — the runtime intercepts this, stores it as
BnSafeAreaInsets.Current, and re-renders a live session; it does
not reach subscribers. The payload is flat JSON with string-valued numbers:
{"top":"47","right":"0","bottom":"34","left":"0"} — all four edge keys
are required.
public static string SafeAreaChanged;
OnResume
The app returned to the foreground. Android onResume,
iOS didBecomeActive.
public static string OnResume;
OnPause
The app left the foreground. Android onPause, iOS
willResignActive — which fires on partial obscuring too, matching
Android's semantics rather than didEnterBackground's.
PERSISTENCE BELONGS HERE. BnHostEvents.OnDestroy is best-effort on both platforms and weaker on iOS, which kills suspended apps without it.
public static string OnPause;
OnDestroy
The app is terminating. BEST-EFFORT and NOT GUARANTEED — iOS kills suspended apps without firing it. Save on BnHostEvents.OnPause instead.
public static string OnDestroy;