graniteEvent
Feature description
Subscribe to system back/home button events.
backEvent— When back navigation occurs, such as Android back button presseshomeEvent— 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?