forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-electron.clipboard.d.ts
76 lines (73 loc) · 2.19 KB
/
github-electron.clipboard.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Type definitions for Electron v0.37.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="github-electron.native-image.d.ts" />
declare namespace Electron {
/**
* The clipboard module provides methods to perform copy and paste operations.
*/
interface Clipboard {
/**
* @returns The contents of the clipboard as plain text.
*/
readText(type?: ClipboardType): string;
/**
* Writes the text into the clipboard as plain text.
*/
writeText(text: string, type?: ClipboardType): void;
/**
* @returns The contents of the clipboard as markup.
*/
readHtml(type?: ClipboardType): string;
/**
* Writes markup to the clipboard.
*/
writeHtml(markup: string, type?: ClipboardType): void;
/**
* @returns The contents of the clipboard as a NativeImage.
*/
readImage(type?: ClipboardType): NativeImage;
/**
* Writes the image into the clipboard.
*/
writeImage(image: NativeImage, type?: ClipboardType): void;
/**
* @returns The contents of the clipboard as RTF.
*/
readRtf(type?: ClipboardType): string;
/**
* Writes the text into the clipboard in RTF.
*/
writeRtf(text: string, type?: ClipboardType): void;
/**
* Clears everything in clipboard.
*/
clear(type?: ClipboardType): void;
/**
* @returns Array available formats for the clipboard type.
*/
availableFormats(type?: ClipboardType): string[];
/**
* Returns whether the clipboard supports the format of specified data.
* Note: This API is experimental and could be removed in future.
* @returns Whether the clipboard has data in the specified format.
*/
has(format: string, type?: ClipboardType): boolean;
/**
* Reads the data in the clipboard of the specified format.
* Note: This API is experimental and could be removed in future.
*/
read(format: string, type?: ClipboardType): any;
/**
* Writes data to the clipboard.
*/
write(data: {
text?: string;
rtf?: string;
html?: string;
image?: NativeImage;
}, type?: ClipboardType): void;
}
type ClipboardType = '' | 'selection';
}