| OLD | NEW |
| 1 'use strict'; | 1 'use strict'; |
| 2 | 2 |
| 3 // This polyfil library implements the following WebIDL: | 3 // This polyfill library implements the WebUSB Test API as specified here: |
| 4 // | 4 // https://wicg.github.io/webusb/test/ |
| 5 // partial interface USB { | |
| 6 // [SameObject] readonly attribute USBTest test; | |
| 7 // } | |
| 8 // | |
| 9 // interface USBTest { | |
| 10 // attribute EventHandler ondeviceclose; | |
| 11 // attribute FakeUSBDevice? chosenDevice; | |
| 12 // attribute FrozenArray<USBDeviceFilter>? lastFilters; | |
| 13 // | |
| 14 // Promise<void> initialize(); | |
| 15 // Promise<void> attachToWindow(Window window); | |
| 16 // FakeUSBDevice addFakeDevice(FakeUSBDeviceInit deviceInit); | |
| 17 // void reset(); | |
| 18 // }; | |
| 19 // | |
| 20 // interface FakeUSBDevice { | |
| 21 // void disconnect(); | |
| 22 // }; | |
| 23 // | |
| 24 // dictionary FakeUSBDeviceInit { | |
| 25 // octet usbVersionMajor; | |
| 26 // octet usbVersionMinor; | |
| 27 // octet usbVersionSubminor; | |
| 28 // octet deviceClass; | |
| 29 // octet deviceSubclass; | |
| 30 // octet deviceProtocol; | |
| 31 // unsigned short vendorId; | |
| 32 // unsigned short productId; | |
| 33 // octet deviceVersionMajor; | |
| 34 // octet deviceVersionMinor; | |
| 35 // octet deviceVersionSubminor; | |
| 36 // DOMString? manufacturerName; | |
| 37 // DOMString? productName; | |
| 38 // DOMString? serialNumber; | |
| 39 // octet activeConfigurationValue = 0; | |
| 40 // sequence<FakeUSBConfigurationInit> configurations; | |
| 41 // }; | |
| 42 // | |
| 43 // dictionary FakeUSBConfigurationInit { | |
| 44 // octet configurationValue; | |
| 45 // DOMString? configurationName; | |
| 46 // sequence<FakeUSBInterfaceInit> interfaces; | |
| 47 // }; | |
| 48 // | |
| 49 // dictionary FakeUSBInterfaceInit { | |
| 50 // octet interfaceNumber; | |
| 51 // sequence<FakeUSBAlternateInterfaceInit> alternates; | |
| 52 // }; | |
| 53 // | |
| 54 // dictionary FakeUSBAlternateInterfaceInit { | |
| 55 // octet alternateSetting; | |
| 56 // octet interfaceClass; | |
| 57 // octet interfaceSubclass; | |
| 58 // octet interfaceProtocol; | |
| 59 // DOMString? interfaceName; | |
| 60 // sequence<FakeUSBEndpointInit> endpoints; | |
| 61 // }; | |
| 62 // | |
| 63 // dictionary FakeUSBEndpointInit { | |
| 64 // octet endpointNumber; | |
| 65 // USBDirection direction; | |
| 66 // USBEndpointType type; | |
| 67 // unsigned long packetSize; | |
| 68 // }; | |
| 69 | 5 |
| 70 (() => { | 6 (() => { |
| 71 | 7 |
| 72 // The global mojo object contains the Mojo JS binding modules loaded during | 8 // The global mojo object contains the Mojo JS binding modules loaded during |
| 73 // initialization. | 9 // initialization. |
| 74 let mojo = null; | 10 let mojo = null; |
| 75 | 11 |
| 76 // These variables are logically members of the USBTest class but are defined | 12 // These variables are logically members of the USBTest class but are defined |
| 77 // here to hide them from being visible as fields of navigator.usb.test. | 13 // here to hide them from being visible as fields of navigator.usb.test. |
| 78 let g_initializePromise = null; | 14 let g_initializePromise = null; |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 509 |
| 574 g_deviceManager.removeAllDevices(); | 510 g_deviceManager.removeAllDevices(); |
| 575 g_chooserService.setChosenDevice(null); | 511 g_chooserService.setChosenDevice(null); |
| 576 g_closeListener = null; | 512 g_closeListener = null; |
| 577 } | 513 } |
| 578 } | 514 } |
| 579 | 515 |
| 580 navigator.usb.test = new USBTest(); | 516 navigator.usb.test = new USBTest(); |
| 581 | 517 |
| 582 })(); | 518 })(); |
| OLD | NEW |