|
| 1 | +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
| 2 | +/* |
| 3 | + * Clipboard API and events |
| 4 | + * W3C Working Draft, 5 June 2019 |
| 5 | + * The origin of this IDL file is: |
| 6 | + * https://www.w3.org/TR/2019/WD-clipboard-apis-20190605/ |
| 7 | + */ |
| 8 | + |
| 9 | +dictionary ClipboardEventInit : EventInit { |
| 10 | + DataTransfer? clipboardData = null; |
| 11 | +}; |
| 12 | + |
| 13 | +[Constructor(DOMString type, optional ClipboardEventInit eventInitDict), Exposed=Window] |
| 14 | +interface ClipboardEvent : Event { |
| 15 | + readonly attribute DataTransfer? clipboardData; |
| 16 | +}; |
| 17 | + |
| 18 | +partial interface Navigator { |
| 19 | + [SecureContext, SameObject] readonly attribute Clipboard clipboard; |
| 20 | +}; |
| 21 | + |
| 22 | +typedef sequence<ClipboardItem> ClipboardItems; |
| 23 | + |
| 24 | +[SecureContext, Exposed=Window] interface Clipboard : EventTarget { |
| 25 | + Promise<ClipboardItems> read(); |
| 26 | + Promise<DOMString> readText(); |
| 27 | + Promise<void> write(ClipboardItems data); |
| 28 | + Promise<void> writeText(DOMString data); |
| 29 | +}; |
| 30 | + |
| 31 | +typedef (DOMString or Blob) ClipboardItemDataType; |
| 32 | +typedef Promise<ClipboardItemDataType> ClipboardItemData; |
| 33 | + |
| 34 | +callback ClipboardItemDelayedCallback = ClipboardItemData (); |
| 35 | + |
| 36 | +[Constructor(record<DOMString, ClipboardItemData> items, |
| 37 | + optional ClipboardItemOptions options), |
| 38 | + Exposed=Window] interface ClipboardItem { |
| 39 | + static ClipboardItem createDelayed( |
| 40 | + record<DOMString, ClipboardItemDelayedCallback> items, |
| 41 | + optional ClipboardItemOptions options); |
| 42 | + |
| 43 | + readonly attribute PresentationStyle presentationStyle; |
| 44 | + readonly attribute long long lastModified; |
| 45 | + readonly attribute boolean delayed; |
| 46 | + |
| 47 | + readonly attribute FrozenArray<DOMString> types; |
| 48 | + |
| 49 | + Promise<Blob> getType(DOMString type); |
| 50 | +}; |
| 51 | + |
| 52 | +enum PresentationStyle { "unspecified", "inline", "attachment" }; |
| 53 | + |
| 54 | +dictionary ClipboardItemOptions { |
| 55 | + PresentationStyle presentationStyle = "unspecified"; |
| 56 | +}; |
| 57 | + |
| 58 | +dictionary ClipboardPermissionDescriptor : PermissionDescriptor { |
| 59 | + boolean allowWithoutGesture = false; |
| 60 | +}; |
0 commit comments