始め方
このプラグインのインストールステップとフルマークダウンガイドを含むセットアッププロンプトをコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-persistent-account`
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/persistent-account/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.
インストール
「インストール」のセクションAI-Assisted Setupを使用してプラグインをインストールできます。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-persistent-account` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-persistent-accountbunx cap syncインポート
インポートimport { CapacitorPersistentAccount } from '@capgo/capacitor-persistent-account';APIの概要
APIの概要readAccount
readAccountのセクション__CAPGO_KEEP_0__を読み取ります。
__CAPGO_KEEP_0__はsaveAccount()を使用して保存したアカウントデータを読み取ります。データはアプリのセッションをまたいで保存され、サポートされているプラットフォームでアプリを再インストールしてもデータは残ります。
import { CapacitorPersistentAccount } from '@capgo/capacitor-persistent-account';
const result = await CapacitorPersistentAccount.readAccount();if (result.data) { console.log('Account data:', result.data);} else { console.log('No account data found');}saveAccount
saveAccountのセクションアカウントデータを永続ストレージに保存します。
提供されたアカウントデータをプラットフォーム固有の安全なストレージメカニズムを使用して保存します。 アプリのセッションをまたいだり、アプリを再インストールしたりしてもデータは永続します。 既存のアカウントデータは上書きされます。
import { CapacitorPersistentAccount } from '@capgo/capacitor-persistent-account';
await CapacitorPersistentAccount.saveAccount({ data: { userId: '12345', username: 'john.doe', email: 'john@example.com' }});真実の源
「真実の源」セクションこのページはプラグインの src/definitions.tsパブリックAPIがアップストリームで変更されたときに再度Syncを実行してください。
続けてGetting Started
「続けてGetting Started」セクションCapgoを使用している場合 はじめに ダッシュボードとAPIの計画と実行を支援するために Using @capgo/capacitor-persistent-account for the native capability in Using @capgo/capacitor-persistent-account API for the implementation detail in API Overview Introduction for the implementation detail in Introduction API キー for API Keys の実装詳細について Devices デバイスの実装詳細のために。