webhid.idl (3904B)
1 // GENERATED CONTENT - DO NOT EDIT 2 // Content was automatically extracted by Reffy into webref 3 // (https://github.com/w3c/webref) 4 // Source: WebHID API (https://wicg.github.io/webhid/) 5 6 [SecureContext] partial interface Navigator { 7 [SameObject] readonly attribute HID hid; 8 }; 9 10 [Exposed=(DedicatedWorker,ServiceWorker), SecureContext] 11 partial interface WorkerNavigator { 12 [SameObject] readonly attribute HID hid; 13 }; 14 15 [Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] 16 interface HID : EventTarget { 17 attribute EventHandler onconnect; 18 attribute EventHandler ondisconnect; 19 Promise<sequence<HIDDevice>> getDevices(); 20 [Exposed=Window] Promise<sequence<HIDDevice>> requestDevice( 21 HIDDeviceRequestOptions options); 22 }; 23 24 dictionary HIDDeviceRequestOptions { 25 required sequence<HIDDeviceFilter> filters; 26 sequence<HIDDeviceFilter> exclusionFilters; 27 }; 28 29 dictionary HIDDeviceFilter { 30 unsigned long vendorId; 31 unsigned short productId; 32 unsigned short usagePage; 33 unsigned short usage; 34 }; 35 36 [Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] 37 interface HIDDevice : EventTarget { 38 attribute EventHandler oninputreport; 39 readonly attribute boolean opened; 40 readonly attribute unsigned short vendorId; 41 readonly attribute unsigned short productId; 42 readonly attribute DOMString productName; 43 readonly attribute FrozenArray<HIDCollectionInfo> collections; 44 Promise<undefined> open(); 45 Promise<undefined> close(); 46 Promise<undefined> forget(); 47 Promise<undefined> sendReport([EnforceRange] octet reportId, BufferSource data); 48 Promise<undefined> sendFeatureReport( 49 [EnforceRange] octet reportId, 50 BufferSource data); 51 Promise<DataView> receiveFeatureReport([EnforceRange] octet reportId); 52 }; 53 54 [Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] 55 interface HIDConnectionEvent : Event { 56 constructor(DOMString type, HIDConnectionEventInit eventInitDict); 57 [SameObject] readonly attribute HIDDevice device; 58 }; 59 60 dictionary HIDConnectionEventInit : EventInit { 61 required HIDDevice device; 62 }; 63 64 [Exposed=(DedicatedWorker,ServiceWorker,Window), SecureContext] 65 interface HIDInputReportEvent : Event { 66 constructor(DOMString type, HIDInputReportEventInit eventInitDict); 67 [SameObject] readonly attribute HIDDevice device; 68 readonly attribute octet reportId; 69 readonly attribute DataView data; 70 }; 71 72 dictionary HIDInputReportEventInit : EventInit { 73 required HIDDevice device; 74 required octet reportId; 75 required DataView data; 76 }; 77 78 dictionary HIDCollectionInfo { 79 unsigned short usagePage; 80 unsigned short usage; 81 octet type; 82 sequence<HIDCollectionInfo> children; 83 sequence<HIDReportInfo> inputReports; 84 sequence<HIDReportInfo> outputReports; 85 sequence<HIDReportInfo> featureReports; 86 }; 87 88 dictionary HIDReportInfo { 89 octet reportId; 90 sequence<HIDReportItem> items; 91 }; 92 93 dictionary HIDReportItem { 94 boolean isAbsolute; 95 boolean isArray; 96 boolean isBufferedBytes; 97 boolean isConstant; 98 boolean isLinear; 99 boolean isRange; 100 boolean isVolatile; 101 boolean hasNull; 102 boolean hasPreferredState; 103 boolean wrap; 104 sequence<unsigned long> usages; 105 unsigned long usageMinimum; 106 unsigned long usageMaximum; 107 unsigned short reportSize; 108 unsigned short reportCount; 109 byte unitExponent; 110 HIDUnitSystem unitSystem; 111 byte unitFactorLengthExponent; 112 byte unitFactorMassExponent; 113 byte unitFactorTimeExponent; 114 byte unitFactorTemperatureExponent; 115 byte unitFactorCurrentExponent; 116 byte unitFactorLuminousIntensityExponent; 117 long logicalMinimum; 118 long logicalMaximum; 119 long physicalMinimum; 120 long physicalMaximum; 121 sequence<DOMString> strings; 122 }; 123 124 enum HIDUnitSystem { 125 "none", "si-linear", "si-rotation", "english-linear", 126 "english-rotation", "vendor-defined", "reserved" 127 };