UNPKG

1.08 kBTypeScriptView Raw
1declare const clipboard: {
2 /**
3 Write (copy) to the clipboard asynchronously.
4
5 @param text - The text to write to the clipboard.
6
7 @example
8 ```
9 import clipboard from 'clipboardy';
10
11 await clipboard.write('🦄');
12
13 await clipboard.read();
14 //=> '🦄'
15 ```
16 */
17 write(text: string): Promise<void>;
18
19 /**
20 Read (paste) from the clipboard asynchronously.
21
22 @example
23 ```
24 import clipboard from 'clipboardy';
25
26 await clipboard.write('🦄');
27
28 await clipboard.read();
29 //=> '🦄'
30 ```
31 */
32 read(): Promise<string>;
33
34 /**
35 Write (copy) to the clipboard synchronously.
36
37 __Doesn't work in browsers.__
38
39 @param text - The text to write to the clipboard.
40
41 @example
42 ```
43 import clipboard from 'clipboardy';
44
45 clipboard.writeSync('🦄');
46
47 clipboard.readSync();
48 //=> '🦄'
49 ```
50 */
51 writeSync(text: string): void;
52
53 /**
54 Read (paste) from the clipboard synchronously.
55
56 __Doesn't work in browsers.__
57
58 @example
59 ```
60 import clipboard from 'clipboardy';
61
62 clipboard.writeSync('🦄');
63
64 clipboard.readSync();
65 //=> '🦄'
66 ```
67 */
68 readSync(): string;
69};
70
71export default clipboard;