Skip to content

시작하기

GitHub

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-target
bunx cap sync
import { CapacitorShareTarget } from '@capgo/capacitor-share-target';

공유 받은 이벤트를 듣습니다.

다른 앱에서 애플리케이션으로 콘텐츠를 공유할 때 호출되는 리스너를 등록합니다. 콜백 함수는 제목, 텍스트 및 파일을 포함하는 이벤트 데이터를 받습니다.

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

removeAllListeners 섹션

이 플러그인의 모든 리스너를 제거합니다.

import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
await CapacitorShareTarget.removeAllListeners();

Capacitor 플러그인의 현재 버전을 반환합니다.

__CAPGO_KEEP_0__ 플러그인 구현의 현재 버전을 반환합니다.

import { CapacitorShareTarget } from '@capgo/capacitor-share-target';
const { version} = await CapacitorShareTarget.getPluginVersion();
console.log('Plugin version:', version);

타입 참조

타입 참조

콘텐츠 공유 시 애플리케이션으로 전달되는 이벤트 데이터입니다.

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[];
}

__CAPGO_KEEP_0__로 공유된 파일을 나타냅니다.

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이 업스트림에서 변경될 때 다시 싱크를 실행하세요.

시작하기

시작하기

이러한 기능을 사용 중이라면 시작하기 계획 대시보드 및 API 작업을 위해 native capability을 사용하는 @capgo/capacitor-share-target Using @capgo/capacitor-share-target API 개요 API 개요에 대한 구현 세부 정보를 위해 소개 __CAPGO_KEEP_0__ 키에 대한 구현 세부 정보를 위해 API 키 API 키에 대한 구현 세부 정보를 위해 , 및 기기 __CAPGO_KEEP_0__에 대한 구현 세부 정보를 위해