onGetUsbPrinterInfoRequested property

EventStream<OnGetUsbPrinterInfoRequestedEvent> get onGetUsbPrinterInfoRequested

Event fired when print manager requests information about a USB device that may be a printer. Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the onGetPrintersRequested event. |device|: The USB device. |resultCallback|: Callback to return printer info. The receiving listener must call callback exactly once. If the parameter to this callback is undefined that indicates that the application has determined that the device is not supported.

Implementation

EventStream<OnGetUsbPrinterInfoRequestedEvent>
    get onGetUsbPrinterInfoRequested =>
        $js.chrome.printerProvider.onGetUsbPrinterInfoRequested
            .asStream(($c) => (
                  $js_usb.Device device,
                  $js.PrinterInfoCallback resultCallback,
                ) {
                  return $c(OnGetUsbPrinterInfoRequestedEvent(
                    device: Device.fromJS(device),
                    resultCallback: (PrinterInfo? printerInfo) {
                      //ignore: avoid_dynamic_calls
                      (resultCallback as Function)(printerInfo?.toJS);
                    },
                  ));
                }.toJS);