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 | 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 13x 144x 72x 72x 1x 71x 4x 67x 67x 67x 2x 65x 130x 65x 63x 2x 65x 3x 62x 67x | import "objectFitPolyfill";
import "webrtc-adapter/out/adapter_no_edge_no_global";
import { BrowserCompatibility } from "./lib/browserCompatibility";
import { BrowserHelper } from "./lib/browserHelper";
import { CustomError } from "./lib/customError";
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/barcode";
export * from "./lib/barcodeEncodingRange";
export * from "./lib/barcodePicker";
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/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;
/**
* 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`
*
* Camera access requests and external Scandit Engine library loads are done lazily only when needed by a
* [[BarcodePicker]] (or [[Scanner]]) object. To make the loading process faster when scanning is actually needed, it is
* recommended depending on the use case to create in advance a (hidden and paused) [[BarcodePicker]] or [[Scanner]]
* object, to later simply show and unpause it when needed. You can also eagerly ask only for camera access permissions
* by calling the [[CameraAccess.getCameras]] function.
*
* @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.
* @returns A promise resolving when the library has been configured.
*/
export function configure(
licenseKey: string,
{
engineLocation = "/"
}: {
engineLocation?: string;
} = {}
): Promise<void> {
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}`;
}
}
return Promise.resolve();
}
|