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.
설치
설치 섹션bun add @capgo/capacitor-share-targetbunx cap syncImport
__CAPGO_KEEP_0__ importimport { CapacitorShareTarget } from '@capgo/capacitor-share-target';API 개요
API 개요addListener
__CAPGO_KEEP_1____CAPGO_KEEP_2__ 이벤트를 듣기.
__CAPGO_KEEP_3__ 이벤트를 받았을 때 호출되는 리스너를 등록합니다. 이벤트 데이터에는 제목, 텍스트, 파일이 포함됩니다.
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
__CAPGO_KEEP_4____CAPGO_KEEP_5__ 이벤트 리스너를 모두 제거합니다.
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
await CapacitorShareTarget.removeAllListeners();getPluginVersion
getPluginVersion 섹션Capacitor 네이티브 플러그인 버전을 가져옵니다.
네이티브 플러그인 구현의 현재 버전을 반환합니다.
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
const { version} = await CapacitorShareTarget.getPluginVersion();console.log('Plugin version:', version);타입 참조
타입 참조 섹션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
공유된 파일 섹션애플리케이션으로 공유된 파일을 나타냅니다.
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;}원본
원본이 페이지는 플러그인의 src/definitions.ts. 업스트림에서 API이 변경되면 다시 싱크를 실행하세요.
시작부터 계속
시작부터 계속이 플러그인을 사용하시나요 시작 to plan dashboard and API operations, connect it with Using @capgo/capacitor-share-target Using @capgo/capacitor-share-target API 개요 API 구현 세부 정보에 대한 개요에서 소개 __CAPGO_KEEP_0__ 키 API 키 구현 세부 정보에 대한, 및 for the implementation detail in API Keys, and 구현 세부 정보에 대한 장치. 수정 페이지