ウェブビュー ガーディアン __CAPGO_KEEP_0__ リポジトリ
このプラグインの全体のマークダウンガイドとインストール手順を含むセットアッププロンプトをコピーしてください。
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.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-webview-guardian` plugin in my project.Manual Setup を使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の手順に従ってください。
bun add @capgo/capacitor-webview-guardianbunx cap syncImport
「Import」import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';API の概要
API の概要startMonitoring
startMonitoringstartMonitoring は、フォアグラウンドイベントを監視し、自動的に WebView の健康状態を確認します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.startMonitoring();stopMonitoring
セクションのタイトル “stopMonitoring”自動の前景モニタリングを停止します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.stopMonitoring();getState
セクションのタイトル “getState”最新のモニタリング状態を取得します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.getState();checkNow
セクションのタイトル “checkNow”ウェブビューのヘルスプローブを即座に実行します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.checkNow();StartMonitoringOptions
セクションのタイトル “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
「GuardianState」のセクションexport interface GuardianState { monitoring: boolean; reason: string; timestamp: string; lastHealthyAt?: string; lastRestartAt?: string; lastCrashAt?: string; pendingRestartReason?: string; error?: string;}CheckNowOptions
「CheckNowOptions」のセクションexport interface CheckNowOptions { /** * Text tag describing why a manual check is being requested. */ reason?: string;}CheckResult
「CheckResult」のセクションexport interface CheckResult { healthy: boolean; restarted: boolean; reason: string; timestamp: string; error?: string; pendingRestart?: boolean;}GuardianEvent
「GuardianEvent」のセクションexport type GuardianEvent = GuardianState;RestartStrategy
「RestartStrategy」のセクションexport type RestartStrategy = 'reload' | 'reloadFromOrigin' | 'customUrl';真実の源
ソース オブ トゥルースこのページはプラグインから生成されています。 src/definitions.tsパブリック API がアップストリームで変更されたときは、再度同期を実行してください。
続けてGetting Started
続けてGetting Startedあなたが使用している場合 Getting Started ネイティブメディアとインターフェイスの動作を計画する場合、 ネイティブ機能のために @capgo/capacitor-webview-guardian を使用します。 ネイティブ機能のために @capgo/capacitor-webview-guardian を使用します。 ネイティブ機能のために @capgo/capacitor-live-activities を使用します。 ネイティブ機能のために @capgo/capacitor-live-activities を使用します。 @capgo/capacitor-live-activities Capgo @capgo/capacitor-live-activitiesの実装詳細については Capgo @capgo/capacitor-video-playerを使用 Capgo @capgo/capacitor-video-playerのネイティブ機能を使用 @capgo/capacitor-video-player Capgo @capgo/capacitor-video-playerの実装詳細については