Navaron Bracke

optimize a function typing

1 import 'dart:js_interop'; 1 import 'dart:js_interop';
2 2
3 -import 'package:js/js.dart';  
4 import 'package:web/web.dart'; 3 import 'package:web/web.dart';
5 4
6 /// The JS interop class for the ZXing BrowserMultiFormatReader. 5 /// The JS interop class for the ZXing BrowserMultiFormatReader.
@@ -22,13 +21,13 @@ class ZXingBrowserMultiFormatReader { @@ -22,13 +21,13 @@ class ZXingBrowserMultiFormatReader {
22 } 21 }
23 22
24 extension ZXingBrowserMultiFormatReaderExt on ZXingBrowserMultiFormatReader { 23 extension ZXingBrowserMultiFormatReaderExt on ZXingBrowserMultiFormatReader {
25 - /// Set the source for the [HTMLVideoElement] that acts as input for the barcode reader. 24 + /// Attach a [MediaStream] to a [HTMLVideoElement].
26 /// 25 ///
27 - /// This function takes a [HTMLVideoElement], and a [MediaStream] as arguments,  
28 - /// and returns no result. 26 + /// This function accepts a [MediaStream] and a [HTMLVideoElement] as arguments,
  27 + /// and returns a [JSPromise].
29 /// 28 ///
30 - /// See https://github.com/zxing-js/library/blob/master/src/browser/BrowserCodeReader.ts#L1182  
31 - external JSFunction addVideoSource; 29 + /// See https://github.com/zxing-js/library/blob/master/src/browser/BrowserCodeReader.ts#L406
  30 + external JSFunction attachStreamToVideo;
32 31
33 /// Continuously decode barcodes from a [HTMLVideoElement]. 32 /// Continuously decode barcodes from a [HTMLVideoElement].
34 /// 33 ///
@@ -46,15 +45,6 @@ extension ZXingBrowserMultiFormatReaderExt on ZXingBrowserMultiFormatReader { @@ -46,15 +45,6 @@ extension ZXingBrowserMultiFormatReaderExt on ZXingBrowserMultiFormatReader {
46 /// See https://github.com/zxing-js/library/blob/master/src/browser/BrowserCodeReader.ts#L458 45 /// See https://github.com/zxing-js/library/blob/master/src/browser/BrowserCodeReader.ts#L458
47 external JSFunction isVideoPlaying; 46 external JSFunction isVideoPlaying;
48 47
49 - /// Prepare the video element for the barcode reader.  
50 - ///  
51 - /// This function takes a [HTMLVideoElement] as argument,  
52 - /// and returns the same [HTMLVideoElement],  
53 - /// after it was prepared for the barcode reader.  
54 - ///  
55 - /// See https://github.com/zxing-js/library/blob/master/src/browser/BrowserCodeReader.ts#L802  
56 - external JSFunction prepareVideoElement;  
57 -  
58 /// Reset the barcode reader to it's initial state, 48 /// Reset the barcode reader to it's initial state,
59 /// and stop any ongoing barcode decoding. 49 /// and stop any ongoing barcode decoding.
60 /// 50 ///