For the complete documentation index, see llms.txt. This page is also available as Markdown.

graniteEvent

Feature description

Subscribe to system back/home button events.

  • backEvent — When back navigation occurs, such as Android back button presses

  • homeEvent — When navigation to Home occurs

Type

graniteEvent.addEventListener(
  event: "backEvent" | "homeEvent",
  args: { onEvent: () => void; onError?: (error: Error) => void },
): () => void;

Params

  • event — This is the event to subscribe to. backEvent(back navigation, such as Android back button presses), homeEvent(home navigation) is one of them.

  • args.onEvent: () => void — Called when the event occurs.

  • args.onError?: (error: Error) => void — Called if an error occurs while handling the subscription.

Response

Returns a function that unsubscribes () => void. Calling it removes the listener.

Example code

Was this helpful?