WebViewRef
A WebView's ref that also holds the page's state as signals, kept by its
load and navigation events. Called while a component sets up, which owns
it, like ref().
Utilização
Give an embedded help page a reload action.
Este tipo é usado por webViewRef
// Give an embedded help page a reload action.
import { Button, WebView, VStack, webViewRef } from 'kuito';
export function Help() {
const page = webViewRef();
return (
<VStack flex={1}>
<Button
disabled={page.loading.value}
onPress={() => void page.current?.reload().catch(console.error)}
>
Reload help
</Button>
<WebView
ref={page}
src="https://example.com/help"
allowedOrigins={['https://example.com']}
flex={1}
/>
</VStack>
);
}Declaração do tipo
export type WebViewRef = ElementRef<WebViewHandle> & {
readonly url: ReadonlySignal<string>;
readonly title: ReadonlySignal<string>;
readonly loading: ReadonlySignal<boolean>;
readonly canGoBack: ReadonlySignal<boolean>;
readonly canGoForward: ReadonlySignal<boolean>;
};Membros 6
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
current | WebViewHandle | Sim | — |
urlsó de leitura | ReadonlySignal<string> | Sim | — |
titlesó de leitura | ReadonlySignal<string> | Sim | — |
loadingsó de leitura | ReadonlySignal<boolean> | Sim | — |
canGoBacksó de leitura | ReadonlySignal<boolean> | Sim | — |
canGoForwardsó de leitura | ReadonlySignal<boolean> | Sim | — |
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.