Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 15x 73x 146x 146x 146x 73x 73x 73x 2x 71x 4x 67x 67x 67x 2x 65x 130x 65x 63x 2x 65x 6x 59x 67x 67x 67x 67x | import "objectFitPolyfill"; import { BlurryRecognitionPreloader } from "./lib/blurryRecognitionPreloader"; import { BrowserCompatibility } from "./lib/browserCompatibility"; import { BrowserHelper } from "./lib/browserHelper"; import { CustomError } from "./lib/customError"; import { EngineLoader } from "./lib/engineLoader"; import { UnsupportedBrowserError } from "./lib/unsupportedBrowserError"; import "./styles/styles.scss"; /** * @hidden */ declare global { interface Window { MediaStreamTrack?: { getSources?(callback: (devices: MediaDeviceInfo[]) => void): void; }; Worker: Function; WebAssembly: object; OffscreenCanvas: Function; WebGLRenderingContext: Function; objectFitPolyfill(elements?: HTMLElement | HTMLElement[]): void; } interface Navigator { mozVibrate?: Navigator["vibrate"]; msVibrate?: Navigator["vibrate"]; webkitVibrate?: Navigator["vibrate"]; enumerateDevices?(): Promise<MediaDeviceInfo[]>; } } export * from "./lib/barcodePicker/barcodePicker"; export * from "./lib/barcode"; export * from "./lib/barcodeEncodingRange"; export * from "./lib/browserCompatibility"; export * from "./lib/browserHelper"; export * from "./lib/camera"; export * from "./lib/cameraAccess"; export * from "./lib/cameraSettings"; export * from "./lib/customError"; export * from "./lib/imageSettings"; export * from "./lib/point"; export * from "./lib/quadrilateral"; export * from "./lib/parser"; export * from "./lib/parserField"; export * from "./lib/parserResult"; export * from "./lib/scanResult"; export * from "./lib/scanner"; export * from "./lib/scanSettings"; export * from "./lib/singleImageModeSettings"; export * from "./lib/searchArea"; export * from "./lib/symbologySettings"; export * from "./lib/workers/engineWorker"; /** * @hidden */ export let deviceId: string = BrowserHelper.getDeviceId(); /** * @hidden */ export let userLicenseKey: string | undefined; /** * @hidden */ export let scanditEngineLocation: string; /** * @hidden */ export let blurryRecognitionPreloader: BlurryRecognitionPreloader; /** * @hidden */ export let engineLoader: EngineLoader; /** * Initialize and configure the Scandit Barcode Scanner SDK library. This function must be called as first thing * before using any other function of the library. * * Depending on parameters and device features, any of the following errors could be the rejected result of the returned * promise: * - `NoLicenseKeyError` * - `UnsupportedBrowserError` * * The external external Scandit Engine library and data needed for blurry recognition are preloaded asynchronously * eagerly by default after library configuration to ensure the best performance. If needed this behaviour can be * changed via the *preloadEngine* and *preloadBlurryRecognition* options. * * Camera access requests are done lazily only when needed by a [[BarcodePicker]] (or [[Scanner]]) object. You can also * eagerly ask only for camera access permissions by calling the [[CameraAccess.getCameras]] function. * * Ideally, to make the scanning process faster, it is recommended depending on the use case to create in * advance a (hidden and paused) [[BarcodePicker]] or [[Scanner]] object, to later show and unpause it when needed. * Depending on the options this can also be used to correctly ask for camera access permissions whenever preferred. * * @param licenseKey The Scandit license key to be used by the library. * @param engineLocation <div class="tsd-signature-symbol">Default = "/"</div> * The location of the folder containing the external scandit-engine-sdk.min.js and * scandit-engine-sdk.wasm files (external Scandit Engine library). * By default they are retrieved from the root of the web application. * Can be a full URL to folder or an absolute folder path. * @param preloadBlurryRecognition <div class="tsd-signature-symbol">Default = true</div> * Whether to preload (load or generate if needed) data needed for blurry recognition as soon as possible via a separate * asynchronous WebWorker thread running the Scandit Engine library. Data for all symbologies is generated over time. * * If enabled, any [[BarcodePicker]] or [[Scanner]] object will be able to start processing video frames much faster, as * it won't need to generate blurry recognition data lazily only when needed. If necessary, depending on given * [[ScanSettings]] options and on readiness of the data, processing is also initially performed without blurry * recognition until this data becomes available, at which point the new data will be loaded and used. * * If disabled, [[BarcodePicker]] or [[Scanner]] objects will load or generate blurry recognition data lazily when * needed to process the first frame, depending on given [[ScanSettings]] options, and will thus require more time the * first time the library is actively used with the given active symbologies. As this needs to be done in the same * WebWorker, the processing of the frame will then be blocked until the needed data is loaded or generated. * * Note that in either case the data for blurry recognition will be cached for later successive uses of the library. * * Note that preloading does not trigger a device activation for licensing purposes. * @param preloadEngine <div class="tsd-signature-symbol">Default = true</div> * Whether to preload (download if needed, compile/instantiate WebAssembly code and initialize) the external Scandit * Engine library, used by [[BarcodePicker]] and [[Scanner]] objects to perform scan operations. * * If enabled, any [[BarcodePicker]] or [[Scanner]] object will be ready to start processing video frames much faster, * as the needed external Scandit Engine library will already be in a partially or fully initialized state thanks to it * being preloaded now. * * If disabled, [[BarcodePicker]] and [[Scanner]] objects will load the external Scandit Engine library on creation * (if it wasn't already loaded before by a previously created object), and will thus require more time to be * initialized and ready. * * Note that in either case the loaded external Scandit Engine library will be reused whenever possible for later * successive uses of the library. * * Note that preloading does not trigger a device activation for licensing purposes. * * @returns A promise resolving when the library has been configured (preloading is done independently asynchronously). */ export async function configure( licenseKey: string, { engineLocation = "/", preloadBlurryRecognition = true, preloadEngine = true, }: { engineLocation?: string; preloadBlurryRecognition?: boolean; preloadEngine?: boolean; } = {} ): Promise<void> { console.log("Scandit Web SDK version: %VERSION%"); const browserCompatibility: BrowserCompatibility = BrowserHelper.checkBrowserCompatibility(); if (!browserCompatibility.fullSupport && !browserCompatibility.scannerSupport) { return Promise.reject(new UnsupportedBrowserError(browserCompatibility)); } if (licenseKey == null || licenseKey.trim().length < 64) { return Promise.reject(new CustomError({ name: "NoLicenseKeyError", message: "No license key provided" })); } userLicenseKey = licenseKey; engineLocation += engineLocation.slice(-1) === "/" ? "" : "/"; if (/^https?:\/\//.test(engineLocation)) { scanditEngineLocation = `${engineLocation}`; } else { engineLocation = engineLocation .split("/") .filter((s) => { return s.length > 0; }) .join("/"); if (engineLocation === "") { engineLocation = "/"; } else { engineLocation = `/${engineLocation}/`; } if (location.protocol === "file:" || location.origin === "null") { scanditEngineLocation = `${location.href.split("/").slice(0, -1).join("/")}${engineLocation}`; } else { scanditEngineLocation = `${location.origin}${engineLocation}`; } } blurryRecognitionPreloader = await BlurryRecognitionPreloader.create(preloadBlurryRecognition); blurryRecognitionPreloader.prepareBlurryTables(); engineLoader = new EngineLoader(preloadEngine); return Promise.resolve(); } |