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.
インストール
「インストール」というタイトルのセクション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
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 から続けてください」セクションCloudflare、Capacitor、GitHub、Capgo、code、API、SDK、CLI、npm、bun を使用している場合 Getting Started nativeメディアとインターフェイスの動作を計画するために、 Using @capgo/capacitor-webview-guardian Using @capgo/capacitor-webview-guardianのnative機能 Using @capgo/capacitor-live-activities Using @capgo/capacitor-live-activitiesのnative機能 @capgo/capacitor-live-activities @capgo/capacitor-live-activitiesの実装詳細 Using @capgo/capacitor-video-player Using @capgo/capacitor-video-playerのnative機能 @capgo/capacitor-video-player @capgo/capacitor-video-playerの実装詳細