Getting Started
Ein Setup-Prompt mit den Installationsanweisungen und der vollständigen Markdown-Dokumentation für diesen Plugin kopieren.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-webview-guardian`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/webview-guardian/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
Installieren
Abschnitt mit dem Titel „Installieren“Sie können unsere AI-gestützte Einrichtung verwenden, um das Plugin zu installieren. Fügen Sie die Capgo-Fähigkeiten zu Ihrem KI-Tool hinzu, indem Sie die folgende Befehl ausführen:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-pluginsDann verwenden Sie die folgende Anfrage:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-webview-guardian` plugin in my project.Wenn Sie eine manuelle Einrichtung bevorzugen, installieren Sie das Plugin, indem Sie die folgenden Befehle ausführen und die unten angegebenen plattform-spezifischen Anweisungen befolgen:
bun add @capgo/capacitor-webview-guardianbunx cap syncImportieren
Abschnitt mit dem Titel „Importieren“import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';API Übersicht
Abschnitt mit dem Titel „API Übersicht“startMonitoring
Abschnitt mit dem Titel „startMonitoring“Startet die Beobachtung von Vordergrundereignissen und überprüft automatisch die WebView-Gesundheit.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.startMonitoring();stopMonitoring
Abschnitt mit dem Titel „stopMonitoring“Jede automatische Vordergrundüberwachung wird gestoppt.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.stopMonitoring();Die neueste bekannte Überwachungsstatus wird zurückgegeben.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.getState();Ein WebView-Health-Check wird sofort durchgeführt.
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.checkNow();Typenverweis
Abschnitt mit dem Titel „Typenverweis“StartMonitoringOptions
Abschnitt mit dem Titel „StartMonitoringOptions“export interface StartMonitoringOptions { /** * Delay (in ms) before running a health check after the app re-enters the foreground. * Defaults to 600ms to let the bridge finish resuming. */ foregroundDebounceMs?: number;
/** * Script executed via `evaluateJavascript`/`evaluateJavaScript` to confirm the WebView is alive. * Defaults to `document.readyState`. */ pingScript?: string;
/** * Automatically reloads the WebView when a terminated render process is detected. * Disable to receive `webviewCrashed` events and restart manually. */ autoRestart?: boolean;
/** * Strategy used when restarting the WebView. Defaults to `reload`. */ restartStrategy?: RestartStrategy;
/** * Custom HTTPS/HTTP URL to load when `restartStrategy` is `customUrl`. */ customRestartUrl?: string;
/** * Emits verbose logging in the native layer when true. */ debug?: boolean;
/** * Whether an immediate health check should be executed right after enabling monitoring. * Defaults to `true`. */ runInitialCheck?: boolean;}GuardianState
Abschnitt mit dem Titel „GuardianState“export interface GuardianState { monitoring: boolean; reason: string; timestamp: string; lastHealthyAt?: string; lastRestartAt?: string; lastCrashAt?: string; pendingRestartReason?: string; error?: string;}CheckNowOptions
Abschnitt mit dem Titel „CheckNowOptions“export interface CheckNowOptions { /** * Text tag describing why a manual check is being requested. */ reason?: string;}CheckResult
Abschnitt mit dem Titel „CheckResult“export interface CheckResult { healthy: boolean; restarted: boolean; reason: string; timestamp: string; error?: string; pendingRestart?: boolean;}GuardianEvent
Abschnitt mit dem Titel „GuardianEvent“export type GuardianEvent = GuardianState;RestartStrategy
Abschnitt mit dem Titel „RestartStrategy“export type RestartStrategy = 'reload' | 'reloadFromOrigin' | 'customUrl';Quelle der Wahrheit
Quelle der WahrheitDiese Seite wurde aus dem Plugin generiert. src/definitions.tsRe-run die Synchronisation, wenn die öffentliche API upstream ändert.
Bleiben Sie bei Getting Started
Bleiben Sie bei Getting StartedWenn Sie native Medien und Schnittstellenverhalten planen, verbinden Sie es mit Verwenden Sie @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian Verwenden Sie @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian für die native Fähigkeit in Verwenden Sie @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian Verwenden Sie @capgo/capacitor-live-activities Verwenden Sie @capgo/capacitor-live-activities für die native Fähigkeit in Verwenden Sie @capgo/capacitor-live-activities Using @capgo/capacitor-live-activities for the native capability in Using @capgo/capacitor-live-activities, @capgo/capacitor-live-aktivitäten für die Implementierungsdetails in @capgo/capacitor-live-aktivitäten Mit @capgo/capacitor-video-player für die native Fähigkeit in Mit @capgo/capacitor-video-player und @capgo/capacitor-video-player für die Implementierungsdetails in @capgo/capacitor-video-player.