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-share-target`
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/share-target/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 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-share-target` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하여 플러그인을 설치하고 아래의 플랫폼별 지침을 따르세요.
bun add @capgo/capacitor-share-targetbunx cap syncImport
제목이 ‘Import’인 섹션import { CapacitorShareTarget } from '@capgo/capacitor-share-target';API 개요
제목이 ‘API 개요’인 섹션addListener
제목이 ‘addListener’인 섹션공유받은 이벤트를 듣다.
__CAPGO_KEEP_0__ 개요 섹션에서 공유받은 이벤트를 듣는 리스너를 등록합니다. 다른 앱에서 애플리케이션으로 콘텐츠를 공유할 때 호출되는 콜백 함수입니다. 콜백 함수는 제목, 텍스트, 파일을 포함하는 이벤트 데이터를 받습니다.
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
const listener = await CapacitorShareTarget.addListener('shareReceived', (event) => { console.log('Title:', event.title); console.log('Texts:', event.texts); event.files?.forEach(file => { console.log(`File: ${file.name} (${file.mimeType})`); });});
// To remove the listener:await listener.remove();removeAllListeners
Section titled “removeAllListeners”이 플러그인의 모든 리스너를 제거합니다.
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
await CapacitorShareTarget.removeAllListeners();getPluginVersion
Section titled “getPluginVersion”이 플러그인의 현재 Capacitor 버전을 가져옵니다.
현재 플러그인 구현의 버전을 반환합니다.
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
const { version} = await CapacitorShareTarget.getPluginVersion();console.log('Plugin version:', version);Type Reference
Section titled “Type Reference”ShareReceivedEvent
Section titled “ShareReceivedEvent”애플리케이션으로 콘텐츠가 공유될 때 받은 이벤트 데이터입니다.
export interface ShareReceivedEvent { /** * The title of the shared content. * * @since 0.1.0 */ title: string;
/** * Array of text content shared to the application. * * @since 0.1.0 */ texts: string[];
/** * Array of files shared to the application. * * @since 0.2.0 */ files: SharedFile[];}SharedFile
SharedFile 섹션 제목SharedFile 섹션에 대한 설명입니다.
export interface SharedFile { /** * The URI of the shared file. On Android/iOS this will be a file path or data URL. * On web this will be a cached URL accessible via fetch. * * @since 0.1.0 */ uri: string;
/** * The name of the shared file, with or without extension. * * @since 0.1.0 */ name: string;
/** * The MIME type of the shared file. * * @since 0.1.0 */ mimeType: string;}실질적인 데이터
Source Of Truth 섹션 제목이 페이지는 플러그인의 src/definitions.ts. 업스트림에서 API가 변경되면 다시 싱크를 실행하세요.
Getting Started에서 계속
Getting Started에서 계속하기 섹션 제목Capgo를 사용하는 경우 Getting Started 를 사용하여 대시보드와 API를 계획하고 운영하는 경우에 연결하세요. Using @capgo/capacitor-share-target for the native capability in Using @capgo/capacitor-share-target API Overview for the implementation detail in API Overview Introduction for the implementation detail in Introduction API Keys for the implementation detail in API Keys, and Devices for the implementation detail in Devices.