forked from arc-archive/clipboard-copy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clipboard-copy.d.ts
67 lines (59 loc) · 1.65 KB
/
clipboard-copy.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
/**
* DO NOT EDIT
*
* This file was automatically generated by
* https://github.com/Polymer/gen-typescript-declarations
*
* To modify these typings, edit the source file(s):
* clipboard-copy.html
*/
/// <reference path="../polymer/types/polymer-element.d.ts" />
declare namespace LogicElements {
/**
* An element that copies a text to clipboard.
*
* ### Example
*
* ```html
* <clipboard-copy content="test"></clipboard-copy>
* <script>
* const elm = document.querySelectior('clipboard-copy');
* if(elm.copy()) {
* console.info('Content has been copied to the clipboard');
* } else {
* console.error('Content copy error. This browser is ancient!');
* }
* < /script>
* ```
*/
class ClipboardCopy extends Polymer.Element {
/**
* A content to be copied to the clipboard.
* It must be set before calling the `copy` function.
*/
content: string|null|undefined;
/**
* Execute content copy.
*
* @returns True if the content has been copied to the clipboard
* and false if there was an error.
*/
copy(): Boolean|null;
/**
* Sends the `content-copy` event.
* If the event is canceled then the logic from this element won't be
* executed. Useful if current platform doesn't support `execCommand('copy')`
* and has other way to manage clipboard.
*
* @returns True if handler executed copy function.
*/
_beforeCopy(): Boolean|null;
/**
* Sends the `content-copied` event that is not bubbling.
*/
_notifyCopied(): any;
}
}
interface HTMLElementTagNameMap {
"clipboard-copy": LogicElements.ClipboardCopy;
}