1 Star 0 Fork 3.9K

Feng Lin/interface_sdk-js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
@ohos.pasteboard.d.ts 55.95 KB
一键复制 编辑 原始数据 按行查看 历史
ududu 提交于 2024-08-28 14:17 +08:00 . update api/@ohos.pasteboard.d.ts.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @kit BasicServicesKit
*/
import { AsyncCallback } from './@ohos.base';
import Want from './@ohos.app.ability.Want';
import image from './@ohos.multimedia.image';
import unifiedDataChannel from './@ohos.data.unifiedDataChannel';
/**
* systemPasteboard
* @namespace pasteboard
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
*/
/**
* systemPasteboard
* @namespace pasteboard
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
declare namespace pasteboard {
/**
* Indicates the maximum number of records allowed in a PasteData object.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Indicates the maximum number of records allowed in a PasteData object.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MAX_RECORD_NUM: number;
/**
* Indicates MIME types of HTML text.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Indicates MIME types of HTML text.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MIMETYPE_TEXT_HTML: string;
/**
* Indicates MIME types of wants.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Indicates MIME types of wants.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MIMETYPE_TEXT_WANT: string;
/**
* Indicates MIME types of plain text.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Indicates MIME types of plain text.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MIMETYPE_TEXT_PLAIN: string;
/**
* Indicates MIME types of URIs.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Indicates MIME types of URIs.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MIMETYPE_TEXT_URI: string;
/**
* Indicates MIME type of PixelMap.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Indicates MIME type of PixelMap.
* @constant
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
const MIMETYPE_PIXELMAP: string;
/**
* Indicates type of value.
* @type { string | image.PixelMap | Want | ArrayBuffer }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Indicates type of value.
* @typedef { string | image.PixelMap | Want | ArrayBuffer }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
type ValueType = string | image.PixelMap | Want | ArrayBuffer;
/**
* Creates a PasteData object for PasteData#MIMETYPE_TEXT_HTML.
* @param { string } htmlText - To save the Html text content.
* @returns { PasteData } Containing the contents of the clipboard content object.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createData
*/
function createHtmlData(htmlText: string): PasteData;
/**
* Creates a PasteData object for PasteData#MIMETYPE_TEXT_WANT.
* @param { Want } want - To save the want of content.
* @returns { PasteData } Containing the contents of the clipboard content object.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createData
*/
function createWantData(want: Want): PasteData;
/**
* Creates a PasteData object for PasteData#MIMETYPE_TEXT_PLAIN.
* @param { string } text - To save the text of content.
* @returns { PasteData } Containing the contents of the clipboard content object.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createData
*/
function createPlainTextData(text: string): PasteData;
/**
* Creates a PasteData object for PasteData#MIMETYPE_TEXT_URI.
* @param { string } uri - To save the uri of content.
* @returns { PasteData } Containing the contents of the clipboard content object.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createData
*/
function createUriData(uri: string): PasteData;
/**
* Creates a PasteData object with MIME type and value.
* @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - indicates the content that is set to PasteData.
* @returns { PasteData } a new PasteData object which contains mimeType and value.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Creates a PasteData object with MIME type and value.
* @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - indicates the content that is set to PasteData.
* @returns { PasteData } a new PasteData object which contains mimeType and value.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
function createData(mimeType: string, value: ValueType): PasteData;
/**
* Creates a Record object for PasteData#MIMETYPE_TEXT_HTML.
* @param { string } htmlText - To save the Html text content.
* @returns { PasteDataRecord } The content of a new record
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createRecord
*/
function createHtmlTextRecord(htmlText: string): PasteDataRecord;
/**
* Creates a Record object for PasteData#MIMETYPE_TEXT_WANT.
* @param { Want } want - To save the want of content.
* @returns { PasteDataRecord } The content of a new record
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createRecord
*/
function createWantRecord(want: Want): PasteDataRecord;
/**
* Creates a Record object for PasteData#MIMETYPE_TEXT_PLAIN.
* @param { string } text - To save the text of content.
* @returns { PasteDataRecord } The content of a new record
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createRecord
*/
function createPlainTextRecord(text: string): PasteDataRecord;
/**
* Creates a Record object for PasteData#MIMETYPE_TEXT_URI.
* @param { string } uri - To save the uri of content.
* @returns { PasteDataRecord } The content of a new record
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#createRecord
*/
function createUriRecord(uri: string): PasteDataRecord;
/**
* Creates a record object with MIME type and value.
* @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - content to be saved.
* @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Creates a record object with MIME type and value.
* @param { string } mimeType - indicates MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - content to be saved.
* @returns { PasteDataRecord } a new PasteDataRecord object which contains mimeType and value.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
function createRecord(mimeType: string, value: ValueType): PasteDataRecord;
/**
* get SystemPasteboard
* @returns { SystemPasteboard } The system clipboard object
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
*/
/**
* get SystemPasteboard
* @returns { SystemPasteboard } The system clipboard object
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
function getSystemPasteboard(): SystemPasteboard;
/**
* Types of scope that PasteData can be pasted.
* @enum { number }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Types of scope that PasteData can be pasted.
* @enum { number }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
enum ShareOption {
/**
* INAPP indicates that only paste in the same app is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* INAPP indicates that only paste in the same app is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
INAPP,
/**
* LOCALDEVICE indicates that paste in any app in this device is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* LOCALDEVICE indicates that paste in any app in this device is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
LOCALDEVICE,
/**
* CROSSDEVICE indicates that paste in any app across devices is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* CROSSDEVICE indicates that paste in any app across devices is allowed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
* @deprecated since 12
*/
CROSSDEVICE
}
/**
* Enumerates the patterns allowed in the system pasteboard.
* @enum { number }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 13
*/
enum Pattern {
/**
* URL pattern.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 13
*/
URL = 0,
/**
* Number pattern.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 13
*/
NUMBER = 1,
/**
* Email address pattern.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 13
*/
EMAIL_ADDRESS = 2,
}
/**
* Paste data property.
* @interface PasteDataProperty
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Paste data property.
* @interface PasteDataProperty
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
interface PasteDataProperty {
/**
* additional property data. key-value pairs.
* @type { object }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* additional property data. key-value pairs.
* @type { object }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
additions: {
[key: string]: object
}
/**
* non-repeating MIME types of all records in PasteData.
* @type { Array<string> }
* @readonly
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* non-repeating MIME types of all records in PasteData.
* @type { Array<string> }
* @readonly
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
readonly mimeTypes: Array<string>;
/**
* the user-defined tag of a PasteData object.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the user-defined tag of a PasteData object.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
tag: string;
/**
* a timestamp, which indicates when data is written to the system pasteboard.
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* a timestamp, which indicates when data is written to the system pasteboard.
* @type { number }
* @readonly
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
readonly timestamp: number;
/**
* Checks whether PasteData is set for local access only.
* @type { boolean }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Checks whether PasteData is set for local access only.
* @type { boolean }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
localOnly: boolean;
/**
* Indicates the scope of clipboard data which can be pasted.
* If it is not set or is incorrectly set, The default value is CrossDevice.
* @type { ShareOption }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Indicates the scope of clipboard data which can be pasted.
* If it is not set or is incorrectly set, The default value is CrossDevice.
* @type { ShareOption }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
shareOption: ShareOption;
}
/**
* Paste data record.
* @interface PasteDataRecord
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Paste data record.
* @interface PasteDataRecord
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
interface PasteDataRecord {
/**
* HTML text in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* HTML text in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
htmlText: string;
/**
* an want in a record.
* @type { Want }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* an want in a record.
* @type { Want }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
want: Want;
/**
* MIME types of a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* MIME types of a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
mimeType: string;
/**
* plain text in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* plain text in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
plainText: string;
/**
* an URI in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* an URI in a record.
* @type { string }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
uri: string;
/**
* PixelMap in a record.
* @type { image.PixelMap }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* PixelMap in a record.
* @type { image.PixelMap }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
pixelMap: image.PixelMap;
/**
* Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data.
* @type { object }
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Custom data in a record, mimeType indicates the MIME type of custom data, ArrayBuffer indicates the value of custom data.
* @type { object }
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
data: {
[mimeType: string]: ArrayBuffer
}
/**
* Converts data in PasteData to text format.
* @param { AsyncCallback<string> } callback - the callback of convertToText.
* @throws { BusinessError } 401 - Possible causes: Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#convertToTextV9
*/
convertToText(callback: AsyncCallback<string>): void;
/**
* Converts data in PasteData to text format.
* @returns { Promise<string> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#convertToTextV9
*/
convertToText(): Promise<string>;
/**
* Converts data in PasteData to text format.
* @returns { string } the string returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Converts data in PasteData to text format.
* @returns { string } the string returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
toPlainText(): string;
}
/**
* Classes for paste data.
* @interface PasteData
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
*/
/**
* Classes for paste data.
* @interface PasteData
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
interface PasteData {
/**
* Adds a Record for HTML text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_HTML in DataProperty.
* @param { string } htmlText - To save the Html text content.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#addRecord
*/
addHtmlRecord(htmlText: string): void;
/**
* Adds an want Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_WANT in DataProperty.
* @param { Want } want - To save the want content.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#addRecord
*/
addWantRecord(want: Want): void;
/**
* Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty.
* @param { PasteDataRecord } record - The content of a new record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* Adds a PasteRecord to a PasteData object and updates MIME types in DataProperty.
* @param { PasteDataRecord } record - The content of a new record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
addRecord(record: PasteDataRecord): void;
/**
* Adds a Record for plain text to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_PLAIN in DataProperty.
* @param { string } text - To save the text of content.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#addRecord
*/
addTextRecord(text: string): void;
/**
* Adds a URI Record to a PasteData object, and updates the MIME type to PasteData#MIMETYPE_TEXT_URI in DataProperty.
* @param { string } uri - To save the uri of content.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#addRecord
*/
addUriRecord(uri: string): void;
/**
* Adds a record with mimeType and value to a PasteData object.
* @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - content to be saved.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @throws { BusinessError } 12900002 - The number of records exceeds the upper limit.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Adds a record with mimeType and value to a PasteData object.
* @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - content to be saved.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 10
*/
/**
* Adds a record with mimeType and value to a PasteData object.
* @param { string } mimeType - indicates the MIME type of value, its size cannot be greater than 1024 bytes.
* @param { ValueType } value - content to be saved.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
addRecord(mimeType: string, value: ValueType): void;
/**
* MIME types of all content on the pasteboard.
* @returns { Array<string> } type of array
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* MIME types of all content on the pasteboard.
* @returns { Array<string> } type of array
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getMimeTypes(): Array<string>;
/**
* HTML text of the primary record in a PasteData object.
* @returns { string } type of htmltext
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* HTML text of the primary record in a PasteData object.
* @returns { string } type of htmltext
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryHtml(): string;
/**
* the want of the primary record in a PasteData object.
* @returns { Want } type of want
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the want of the primary record in a PasteData object.
* @returns { Want } type of want
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryWant(): Want;
/**
* the MIME type of the primary record in a PasteData object.
* @returns { string } type of mimetype
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the MIME type of the primary record in a PasteData object.
* @returns { string } type of mimetype
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryMimeType(): string;
/**
* the plain text of the primary record in a PasteData object.
* @returns { string } type of text
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
*/
/**
* the plain text of the primary record in a PasteData object.
* @returns { string } type of text
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryText(): string;
/**
* the URI of the primary record in a PasteData object.
* @returns { string } type of uri
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the URI of the primary record in a PasteData object.
* @returns { string } type of uri
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryUri(): string;
/**
* Gets the primary PixelMap record in a PasteData object.
* @returns { image.PixelMap } pixelMap
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Gets the primary PixelMap record in a PasteData object.
* @returns { image.PixelMap } pixelMap
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getPrimaryPixelMap(): image.PixelMap;
/**
* DataProperty of a PasteData object.
* @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* DataProperty of a PasteData object.
* @returns { PasteDataProperty } PasteDataProperty type of PasteDataProperty
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getProperty(): PasteDataProperty;
/**
* Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only.
* @param { PasteDataProperty } property - save property to PasteData object.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Sets PasteDataProperty to a PasteData object, Modifying shareOption is supported only.
* @param { PasteDataProperty } property - save property to PasteData object.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
setProperty(property: PasteDataProperty): void;
/**
* Gets record by index in PasteData.
* @param { number } index - indicates the record index in PasteData.
* @returns { PasteDataRecord } the record in PasteData with index.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#getRecord
*/
getRecordAt(index: number): PasteDataRecord;
/**
* Gets record by index in PasteData.
* @param { number } index - indicates the record index in PasteData.
* @returns { PasteDataRecord } the record in PasteData with index.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Gets record by index in PasteData.
* @param { number } index - indicates the record index in PasteData.
* @returns { PasteDataRecord } the record in PasteData with index.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getRecord(index: number): PasteDataRecord;
/**
* the number of records in a PasteData object.
* @returns { number } The number of the clipboard contents
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the number of records in a PasteData object.
* @returns { number } The number of the clipboard contents
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getRecordCount(): number;
/**
* the user-defined tag of a PasteData object.
* @returns { string } type of tag
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
/**
* the user-defined tag of a PasteData object.
* @returns { string } type of tag
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getTag(): string;
/**
* Checks whether there is a specified MIME type of data in DataProperty.
* @param { string } mimeType - indicates to query data type.
* @returns { boolean } if having mimeType in PasteData returns true, else returns false.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#hasType
*/
hasMimeType(mimeType: string): boolean;
/**
* Checks whether there is a specified MIME type of data in DataProperty.
* @param { string } mimeType - indicates to query data type.
* @returns { boolean } if having mimeType in PasteData returns true, else returns false.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Checks whether there is a specified MIME type of data in DataProperty.
* @param { string } mimeType - indicates to query data type.
* @returns { boolean } if having mimeType in PasteData returns true, else returns false.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
hasType(mimeType: string): boolean;
/**
* Removes a Record based on a specified index.
* @param { number } index - indicates the record index in PasteData.
* @returns { boolean } The query returns True on success, or False on failure.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#removeRecord
*/
removeRecordAt(index: number): boolean;
/**
* Removes a Record based on a specified index.
* @param { number } index - indicates the record index in PasteData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Removes a Record based on a specified index.
* @param { number } index - indicates the record index in PasteData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
removeRecord(index: number): void;
/**
* Replaces a specified record with a new one.
* @param { number } index - indicates the record index in PasteData.
* @param { PasteDataRecord } record - the content of a new record.
* @returns { boolean } The query returns True on success, or False on failure.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#replaceRecord
*/
replaceRecordAt(index: number, record: PasteDataRecord): boolean;
/**
* Replaces a specified record with a new one.
* @param { number } index - indicates the record index in PasteData.
* @param { PasteDataRecord } record - the content of a new record.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Replaces a specified record with a new one.
* @param { number } index - indicates the record index in PasteData.
* @param { PasteDataRecord } record - the content of a new record.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900001 - The index is out of the record.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
replaceRecord(index: number, record: PasteDataRecord): void;
/**
* Utilized to notify pasteboard service while reading PasteData, in this case, the service will help to preserve the context and resources
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 12
*/
pasteStart(): void;
/**
* Invoked to notify pasteboard service the utilization of PasteData has completed and occupied resources can be released for further usage
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 12
*/
pasteComplete(): void;
}
/**
* Classes for system pasteboard.
* @interface SystemPasteboard
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
*/
/**
* Classes for system pasteboard.
* @interface SystemPasteboard
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
interface SystemPasteboard {
/**
* Callback invoked when pasteboard content changes.
* @param { 'update' } type - indicates pasteboard content changed.
* @param { function } callback - the callback to add.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
on(type: 'update', callback: () => void): void;
/**
* Remove a callback invoked when pasteboard content changes.
* @param { 'update' } type - indicates pasteboard content changed.
* @param { function } [callback] - the callback to remove. If this parameter is not filled in, it indicates that all
* callbacks for this application will be cleared. Otherwise, it indicates that the specified callback will be cleared.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
*/
off(type: 'update', callback?: () => void): void;
/**
* Checks whether the data is remote.
* @returns { boolean } True is remote data, else false.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
isRemoteData(): boolean;
/**
* Gets source of data.
* @returns { string } data source.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
getDataSource(): string;
/**
* Checks whether there is a specified MIME type of data in Data.
* @param { string } mimeType - indicates to query data type.
* @returns { boolean } if having mimeType in PasteData returns true, else returns false.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
hasDataType(mimeType: string): boolean;
/**
* Clears the pasteboard.
* @param { AsyncCallback<void> } callback - the callback of clearData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#clearData
*/
clear(callback: AsyncCallback<void>): void;
/**
* Clears the pasteboard.
* @returns { Promise<void> } the promise returned by the clearData.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#clearData
*/
clear(): Promise<void>;
/**
* Clears the pasteboard.
* @param { AsyncCallback<void> } callback - the callback of clearData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Clears the pasteboard.
* @param { AsyncCallback<void> } callback - the callback of clearData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
clearData(callback: AsyncCallback<void>): void;
/**
* Clears the pasteboard.
* @returns { Promise<void> } the promise returned by the clearData.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Clears the pasteboard.
* @returns { Promise<void> } the promise returned by the clearData.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
clearData(): Promise<void>;
/**
* Clears the pasteboard.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
clearDataSync(): void;
/**
* Gets pastedata from the system pasteboard.
* @param { AsyncCallback<PasteData> } callback - the callback of getData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#getData
*/
getPasteData(callback: AsyncCallback<PasteData>): void;
/**
* Gets pastedata from the system pasteboard.
* @returns { Promise<PasteData> } the promise returned by the getData.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#getData
*/
getPasteData(): Promise<PasteData>;
/**
* Gets pastedata from the system pasteboard.
* @param { AsyncCallback<PasteData> } callback - the callback of getData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Gets pastedata from the system pasteboard.
* @param { AsyncCallback<PasteData> } callback - the callback of getData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
/**
* Gets pastedata from the system pasteboard.
* @permission ohos.permission.READ_PASTEBOARD
* @param { AsyncCallback<PasteData> } callback - the callback of getData.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the
* permission required to call the API.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
getData(callback: AsyncCallback<PasteData>): void;
/**
* Gets pastedata from the system pasteboard.
* @returns { Promise<PasteData> } the promise returned by the getData.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Gets pastedata from the system pasteboard.
* @returns { Promise<PasteData> } the promise returned by the getData.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
/**
* Gets pastedata from the system pasteboard.
* @permission ohos.permission.READ_PASTEBOARD
* @returns { Promise<PasteData> } the promise returned by the getData.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the
* permission required to call the API.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
getData(): Promise<PasteData>;
/**
* Gets pasteData from the system pasteboard.
* @returns { PasteData } a new PasteData.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
/**
* Gets pasteData from the system pasteboard.
* @permission ohos.permission.READ_PASTEBOARD
* @returns { PasteData } a new PasteData.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the
* permission required to call the API.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
getDataSync(): PasteData;
/**
* Checks whether there is content in the pasteboard.
* @param { AsyncCallback<boolean> } callback - the callback of setPasteData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#hasData
*/
hasPasteData(callback: AsyncCallback<boolean>): void;
/**
* Checks whether there is content in the pasteboard.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 7
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#hasData
*/
hasPasteData(): Promise<boolean>;
/**
* Checks whether there is content in the system pasteboard.
* @param { AsyncCallback<boolean> } callback - the callback of hasData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Checks whether there is content in the system pasteboard.
* @param { AsyncCallback<boolean> } callback - the callback of hasData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
hasData(callback: AsyncCallback<boolean>): void;
/**
* Checks whether there is content in the system pasteboard.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Checks whether there is content in the system pasteboard.
* @returns { Promise<boolean> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
hasData(): Promise<boolean>;
/**
* Checks whether there is content in the system pasteboard.
* @returns { boolean } True exists, false does not exist.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
hasDataSync(): boolean;
/**
* Writes PasteData to the pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard
* @param { AsyncCallback<void> } callback - the callback of setPasteData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#setData
*/
setPasteData(data: PasteData, callback: AsyncCallback<void>): void;
/**
* Writes PasteData to the pasteboard.
* @param { PasteData } data - Containing the contents of the clipboard content object.
* @returns { Promise<void> } the promise returned by the function.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 6
* @deprecated since 9
* @useinstead ohos.pasteboard.pasteboard#setData
*/
setPasteData(data: PasteData): Promise<void>;
/**
* Writes PasteData to the system pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard
* @param { AsyncCallback<void> } callback - the callback of setData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified.
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @throws { BusinessError } 12900004 - Replication is prohibited.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Writes PasteData to the system pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard
* @param { AsyncCallback<void> } callback - the callback of setData.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @throws { BusinessError } 12900004 - Replication is prohibited.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
setData(data: PasteData, callback: AsyncCallback<void>): void;
/**
* Writes PasteData to the system pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @throws { BusinessError } 12900004 - Replication is prohibited.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 9
*/
/**
* Writes PasteData to the system pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @throws { BusinessError } 12900004 - Replication is prohibited.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
setData(data: PasteData): Promise<void>;
/**
* Writes PasteData to the system pasteboard.
* @param { PasteData } data - PasteData will be written to the clipboard.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 11
*/
setDataSync(data: PasteData): void;
/**
* Gets unified data from the system pasteboard.
* @permission ohos.permission.READ_PASTEBOARD
* @returns { Promise<unifiedDataChannel.UnifiedData> } the promise returned by the getData.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the
* permission required to call the API.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
getUnifiedData(): Promise<unifiedDataChannel.UnifiedData>;
/**
* Gets unified data from the system pasteboard.
* @permission ohos.permission.READ_PASTEBOARD
* @returns { unifiedDataChannel.UnifiedData } a new UnifiedData.
* @throws { BusinessError } 201 - Permission verification failed. The application does not have the
* permission required to call the API.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
getUnifiedDataSync(): unifiedDataChannel.UnifiedData;
/**
* Writes unified data to the system pasteboard.
* @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard.
* @returns { Promise<void> } the promise returned by the function.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900003 - Another copy or paste operation is in progress.
* @throws { BusinessError } 12900004 - Replication is prohibited.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
setUnifiedData(data: unifiedDataChannel.UnifiedData): Promise<void>;
/**
* Writes unified data to the system pasteboard.
* @param { unifiedDataChannel.UnifiedData } data - Unified data will be written to the pasteboard.
* @throws { BusinessError } 401 - Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameters types.
* @throws { BusinessError } 12900005 - Request timed out.
* @syscap SystemCapability.MiscServices.Pasteboard
* @atomicservice
* @since 12
*/
setUnifiedDataSync(data: unifiedDataChannel.UnifiedData): void;
/**
* Sets a unified ShareOptions for your application, so that the PasteData copied from your application is applicable to this ShareOptions.
*
* @param { ShareOption } shareOptions - Scope that PasteData can be pasted.
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @throws { BusinessError } 12900006 - Settings already exist.
* @syscap SystemCapability.MiscServices.Pasteboard
* @systemapi
* @since 12
*/
setAppShareOptions(shareOptions: ShareOption): void;
/**
* Removes the unified ShareOptions of your application.
*
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
* @syscap SystemCapability.MiscServices.Pasteboard
* @systemapi
* @since 12
*/
removeAppShareOptions(): void;
/**
* Detects the patterns in the pasteboard.
*
* @param { Array<Pattern> } patterns - Patterns to detect.
* @returns { Promise<Array<Pattern>> } Promise used to return the patterns detected.
* @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
* 2. Incorrect parameter types;
* 3. Parameter verification failed.
* @syscap SystemCapability.MiscServices.Pasteboard
* @since 13
*/
detectPatterns(patterns: Array<Pattern>): Promise<Array<Pattern>>;
}
}
export default pasteboard;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lffl8796/interface_sdk-js.git
git@gitee.com:lffl8796/interface_sdk-js.git
lffl8796
interface_sdk-js
interface_sdk-js
master

搜索帮助