SafeArea.subscribe
Feature description
Every time the Safe Area insets change onEvent Notify me via a callback. When called, it returns a function that unsubscribes. Please unsubscribe when leaving the page.
Type
SafeArea.subscribe(args: { onEvent: (insets: SafeAreaInsets) => void }): () => void;Params
type SafeAreaInsets = {
top: number;
left: number;
right: number;
bottom: number;
};Response
Returns a function that unsubscribes.
Example code
import { SafeArea } from "@apps-in-toss/web-framework";
const unsubscribe = SafeArea.subscribe({
onEvent: (insets) => {
console.log(insets.top, insets.bottom, insets.left, insets.right);
},
});
// Unsubscribe
unsubscribe();Was this helpful?