Getting Started
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップの案内をコピーしてください。
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-Assistedセットアップを使用してプラグインをインストールできます。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セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-webview-guardianbunx cap syncインポート
「インポート」タイトルのセクションimport { WebviewGuardian } from '@capgo/capacitor-webview-guardian';API の概要
「API の概要」タイトルのセクションstartMonitoring
「startMonitoring」タイトルのセクションフォアグラウンドイベントを監視し、自動的に WebView の健康状態を確認します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.startMonitoring();stopMonitoring
「stopMonitoring」タイトルのセクション自動フォアグラウンドモニタリングを停止します。
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.stopMonitoring();getState
__CAPGO_KEEP_1__ “getState”__CAPGO_KEEP_2__
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.getState();checkNow
__CAPGO_KEEP_1__ “checkNow”__CAPGO_KEEP_2__
import { WebviewGuardian } from '@capgo/capacitor-webview-guardian';
await WebviewGuardian.checkNow();Type Reference
__CAPGO_KEEP_1__ “Type Reference”StartMonitoringOptions
__CAPGO_KEEP_1__ “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
__CAPGO_KEEP_1__ “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がアップストリームで変更された場合に、パブリック APIを再度同期してください。
Getting Startedから続けてください
Getting Startedから続けてください「Getting Startedから続けてください」というセクション あなたが「Getting Started」を使用している場合 Getting Startedを使用してネイティブメディアとインターフェイスの動作を計画する場合、Getting Startedを「Using @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-webview-guardian」に接続してください。 「Using @capgo/capacitor-webview-guardian」を使用している場合、ネイティブ機能として「Using @capgo/capacitor-webview-guardian」を使用してください。 「Using @capgo/capacitor-live-activities」を使用している場合、ネイティブ機能として「Using @capgo/capacitor-live-activities」を使用してください。 「@capgo/capacitor-live-activities」を使用している場合、実装詳細として「@capgo/capacitor-live-activities」を使用してください。 @capgo/capacitor-live-activities @capgo/capacitor-live-activities @capgo/capacitor-live-activities @capgo/capacitor-video-player のネイティブ機能を使用するために@capgo/capacitor-video-player for the native capability in @capgo/capacitor-video-player、 @capgo/capacitor-video-player