UNPKG

scandit-sdk

Version:

Scandit Barcode Scanner SDK for the Web

857 lines 46 kB
<!doctype html> <html class="default no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Scanner | Scandit Barcode Scanner SDK for the Web</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="../assets/css/main.css"> </head> <body> <header> <div class="tsd-page-toolbar"> <div class="container"> <div class="table-wrap"> <div class="table-cell" id="tsd-search" data-index="../assets/js/search.js" data-base=".."> <div class="field"> <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label> <input id="tsd-search-field" type="text" /> </div> <ul class="results"> <li class="state loading">Preparing search index...</li> <li class="state failure">The search index is not available</li> </ul> <a href="../index.html" class="title">Scandit Barcode Scanner SDK for the Web</a> </div> <div class="table-cell" id="tsd-widgets"> <div id="tsd-filter"> <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a> <div class="tsd-filter-group"> <div class="tsd-select" id="tsd-filter-visibility"> <span class="tsd-select-label">All</span> <ul class="tsd-select-list"> <li data-value="public">Public</li> <li data-value="protected">Public/Protected</li> <li data-value="private" class="selected">All</li> </ul> </div> <input type="checkbox" id="tsd-filter-inherited" checked /> <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label> <input type="checkbox" id="tsd-filter-externals" checked /> <label class="tsd-widget" for="tsd-filter-externals">Externals</label> <input type="checkbox" id="tsd-filter-only-exported" /> <label class="tsd-widget" for="tsd-filter-only-exported">Only exported</label> </div> </div> <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a> </div> </div> </div> </div> <div class="tsd-page-title"> <div class="container"> <ul class="tsd-breadcrumb"> <li> <a href="../globals.html">Globals</a> </li> <li> <a href="scanner.html">Scanner</a> </li> </ul> <h1>Class Scanner</h1> </div> </div> </header> <div class="container container-main"> <div class="row"> <div class="col-8 col-content"> <section class="tsd-panel tsd-comment"> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>A low-level scanner interacting with the external Scandit Engine library. Used to set up scan / image settings and to process single image frames.</p> </div> <p>The loading of the external Scandit Engine library which takes place on creation can take some time, the <a href="scanner.html#on">on</a> method targeting the <a href="scanner.html#ready">ready</a> event can be used to set up a listener function to be called when the library is loaded and the <a href="scanner.html#isready">isReady</a> method can return the current status. The scanner will be ready to start scanning when the library is fully loaded.</p> <p>In the special case where a single <a href="scanner.html">Scanner</a> instance is shared between multiple active <a href="barcodepicker.html">BarcodePicker</a> instances, the fairness in resource allocation for processing images between the different pickers is not guaranteed.</p> </div> </section> <section class="tsd-panel tsd-hierarchy"> <h3>Hierarchy</h3> <ul class="tsd-hierarchy"> <li> <span class="target">Scanner</span> </li> </ul> </section> <section class="tsd-panel-group tsd-index-group"> <h2>Index</h2> <section class="tsd-panel tsd-index-panel"> <div class="tsd-index-content"> <section class="tsd-index-section "> <h3>Constructors</h3> <ul class="tsd-index-list"> <li class="tsd-kind-constructor tsd-parent-kind-class"><a href="scanner.html#constructor" class="tsd-kind-icon">constructor</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Events</h3> <ul class="tsd-index-list"> <li class="tsd-kind-event tsd-parent-kind-class tsd-is-static"><a href="scanner.html#ready" class="tsd-kind-icon">ready</a></li> </ul> </section> <section class="tsd-index-section "> <h3>Methods</h3> <ul class="tsd-index-list"> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#addlistener" class="tsd-kind-icon">add<wbr>Listener</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#applyimagesettings" class="tsd-kind-icon">apply<wbr>Image<wbr>Settings</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#applyscansettings" class="tsd-kind-icon">apply<wbr>Scan<wbr>Settings</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#clearsession" class="tsd-kind-icon">clear<wbr>Session</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#createparserforformat" class="tsd-kind-icon">create<wbr>Parser<wbr>For<wbr>Format</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#destroy" class="tsd-kind-icon">destroy</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#getimagesettings" class="tsd-kind-icon">get<wbr>Image<wbr>Settings</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#getscansettings" class="tsd-kind-icon">get<wbr>Scan<wbr>Settings</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#isbusyprocessing" class="tsd-kind-icon">is<wbr>Busy<wbr>Processing</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#isready" class="tsd-kind-icon">is<wbr>Ready</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#on" class="tsd-kind-icon">on</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#onready" class="tsd-kind-icon">on<wbr>Ready</a></li> <li class="tsd-kind-method tsd-parent-kind-class"><a href="scanner.html#processimage" class="tsd-kind-icon">process<wbr>Image</a></li> </ul> </section> </div> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Constructors</h2> <section class="tsd-panel tsd-member tsd-kind-constructor tsd-parent-kind-class" > <a name="constructor" class="tsd-anchor"></a> <h3>constructor</h3> <ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">new <wbr>Scanner<span class="tsd-signature-symbol">(</span>__namedParameters<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:51</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a Scanner instance.</p> </div> <p>It is required to having configured the library via <a href="../globals.html#configure">configure</a> before this object can be created.</p> <p>Before processing an image the relative settings must also have been set.</p> <p>If the library has not been correctly configured yet a <code>LibraryNotConfiguredError</code> error is thrown.</p> <p>If a browser is incompatible a <code>UnsupportedBrowserError</code> error is thrown.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> __namedParameters: <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol"> =&nbsp;{}</span></h5> <ul class="tsd-parameters"> <li class="tsd-parameter"> <h5>image<wbr>Settings<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">undefined</span><span class="tsd-signature-symbol"> | </span><a href="../modules/imagesettings.html" class="tsd-signature-type">ImageSettings</a></h5> <div class="tsd-comment tsd-typography"> <div class="tsd-signature-symbol">Default =&nbsp;undefined</div> The configuration object to define the properties of an image to be scanned. </div> </li> <li class="tsd-parameter"> <h5>scan<wbr>Settings<span class="tsd-signature-symbol">: </span><a href="scansettings.html" class="tsd-signature-type">ScanSettings</a></h5> <div class="tsd-comment tsd-typography"> <div class="tsd-signature-symbol">Default =&nbsp;new ScanSettings()</div> The configuration object for scanning options. </div> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Events</h2> <section class="tsd-panel tsd-member tsd-kind-event tsd-parent-kind-class tsd-is-static" data-tags="asmemberof "> <a name="ready" class="tsd-anchor"></a> <h3><span class="tsd-flag ts-flagStatic">Static</span> ready</h3> <ul class="tsd-signatures tsd-kind-event tsd-parent-kind-class tsd-is-static"> <li class="tsd-signature tsd-kind-icon">ready<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:560</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Fired when the external Scandit Engine library has been loaded and the scanner can thus start to scan barcodes.</p> </div> <dl class="tsd-comment-tags"> <dt data-tag="asmemberof">asmemberof</dt> <dd data-tag="asmemberof"><p>Scanner</p> </dd> </dl> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> </section> <section class="tsd-panel-group tsd-member-group "> <h2>Methods</h2> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="addlistener" class="tsd-anchor"></a> <h3>add<wbr>Listener</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">add<wbr>Listener<span class="tsd-signature-symbol">(</span>eventName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventName</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ListenerFn</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:370</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p><em>See the <a href="scanner.html#on">on</a> method.</em></p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>eventName: <span class="tsd-signature-type">EventName</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the event to listen to.</p> </div> </li> <li> <h5>listener: <span class="tsd-signature-type">ListenerFn</span></h5> <div class="tsd-comment tsd-typography"> <p>The listener function.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="applyimagesettings" class="tsd-anchor"></a> <h3>apply<wbr>Image<wbr>Settings</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">apply<wbr>Image<wbr>Settings<span class="tsd-signature-symbol">(</span>imageSettings<span class="tsd-signature-symbol">: </span><a href="../modules/imagesettings.html" class="tsd-signature-type">ImageSettings</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:149</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Apply a new set of image settings to the scanner (replacing old settings).</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>imageSettings: <a href="../modules/imagesettings.html" class="tsd-signature-type">ImageSettings</a></h5> <div class="tsd-comment tsd-typography"> <p>The image configuration object to be applied to the scanner.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="applyscansettings" class="tsd-anchor"></a> <h3>apply<wbr>Scan<wbr>Settings</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">apply<wbr>Scan<wbr>Settings<span class="tsd-signature-symbol">(</span>scanSettings<span class="tsd-signature-symbol">: </span><a href="scansettings.html" class="tsd-signature-type">ScanSettings</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:132</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Apply a new set of scan settings to the scanner (replacing old settings).</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>scanSettings: <a href="scansettings.html" class="tsd-signature-type">ScanSettings</a></h5> <div class="tsd-comment tsd-typography"> <p>The scan configuration object to be applied to the scanner.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="clearsession" class="tsd-anchor"></a> <h3>clear<wbr>Session</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">clear<wbr>Session<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:167</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Clear the scanner session.</p> </div> <p>This removes all recognized barcodes from the scanner session and allows them to be scanned again in case a custom <em>codeDuplicateFilter</em> was set in the <a href="scansettings.html">ScanSettings</a>.</p> </div> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="createparserforformat" class="tsd-anchor"></a> <h3>create<wbr>Parser<wbr>For<wbr>Format</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">create<wbr>Parser<wbr>For<wbr>Format<span class="tsd-signature-symbol">(</span>dataFormat<span class="tsd-signature-symbol">: </span><a href="../enums/parser.dataformat.html" class="tsd-signature-type">DataFormat</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="parser.html" class="tsd-signature-type">Parser</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:380</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Create a new parser object.</p> </div> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>dataFormat: <a href="../enums/parser.dataformat.html" class="tsd-signature-type">DataFormat</a></h5> <div class="tsd-comment tsd-typography"> <p>The format of the input data for the parser.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="parser.html" class="tsd-signature-type">Parser</a></h4> <p>The newly created parser.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="destroy" class="tsd-anchor"></a> <h3>destroy</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">destroy<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:119</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Stop the internal <code>WebWorker</code> and destroy the scanner itself; ensuring complete cleanup.</p> </div> <p>This method should be called after you don&#39;t plan to use the scanner anymore, before the object is automatically cleaned up by JavaScript. The barcode picker must not be used in any way after this call.</p> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="getimagesettings" class="tsd-anchor"></a> <h3>get<wbr>Image<wbr>Settings</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Image<wbr>Settings<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../modules/imagesettings.html" class="tsd-signature-type">ImageSettings</a><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">undefined</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:392</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Return the current image settings.</p> </div> <p>Note that modifying this object won&#39;t directly apply these settings: the <a href="scanner.html#applyimagesettings">applyImageSettings</a> method must be called with the updated object.</p> </div> <h4 class="tsd-returns-title">Returns <a href="../modules/imagesettings.html" class="tsd-signature-type">ImageSettings</a> <span class="tsd-signature-symbol"> | </span> <span class="tsd-signature-type">undefined</span> </h4> <p>The current image settings.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="getscansettings" class="tsd-anchor"></a> <h3>get<wbr>Scan<wbr>Settings</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">get<wbr>Scan<wbr>Settings<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scansettings.html" class="tsd-signature-type">ScanSettings</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:404</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Return the current scan settings.</p> </div> <p>Note that modifying this object won&#39;t directly apply these settings: the <a href="scanner.html#applyscansettings">applyScanSettings</a> method must be called with the updated object.</p> </div> <h4 class="tsd-returns-title">Returns <a href="scansettings.html" class="tsd-signature-type">ScanSettings</a></h4> <p>The current scan settings.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="isbusyprocessing" class="tsd-anchor"></a> <h3>is<wbr>Busy<wbr>Processing</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">is<wbr>Busy<wbr>Processing<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:285</li> </ul> </aside> <div class="tsd-comment tsd-typography"> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>Whether the scanner is currently busy processing an image.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="isready" class="tsd-anchor"></a> <h3>is<wbr>Ready</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">is<wbr>Ready<span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">boolean</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:292</li> </ul> </aside> <div class="tsd-comment tsd-typography"> </div> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">boolean</span></h4> <p>Whether the scanner has loaded the external Scandit Engine library and is ready to scan.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="on" class="tsd-anchor"></a> <h3>on</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>eventName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">EventName</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">ListenerFn</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>eventName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">"ready"</span>, listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:307</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Add the listener function to the listeners array for an event.</p> </div> <p>No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>eventName: <span class="tsd-signature-type">EventName</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the event to listen to.</p> </div> </li> <li> <h5>listener: <span class="tsd-signature-type">ListenerFn</span></h5> <div class="tsd-comment tsd-typography"> <p>The listener function.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:320</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Add the listener function to the listeners array for the <a href="scanner.html#ready">ready</a> event, fired only once when the external Scandit Engine library has been loaded and the scanner can thus start to scan barcodes. If the external Scandit Engine library has already been loaded the listener is called immediately.</p> </div> <p>No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.</p> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>eventName: <span class="tsd-signature-type">"ready"</span></h5> <div class="tsd-comment tsd-typography"> <p>The name of the event to listen to.</p> </div> </li> <li> <h5>listener: <span class="tsd-signature-type">function</span></h5> <div class="tsd-comment tsd-typography"> <p>The listener function.</p> </div> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" data-tags="deprecated "> <a name="onready" class="tsd-anchor"></a> <h3>on<wbr>Ready</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">on<wbr>Ready<span class="tsd-signature-symbol">(</span>listener<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">function</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="scanner.html" class="tsd-signature-type">Scanner</a></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:354</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Add the listener function to the listeners array for the <a href="scanner.html#ready">ready</a> event, fired only once when the external Scandit Engine library has been loaded and the scanner can thus start to scan barcodes. If the external Scandit Engine library has already been loaded the listener is called immediately.</p> </div> <p>No checks are made to see if the listener has already been added. Multiple calls passing the same listener will result in the listener being added, and called, multiple times.</p> <dl class="tsd-comment-tags"> <dt data-tag="deprecated">deprecated</dt> <dd data-tag="deprecated"><p>Use the <a href="scanner.html#on">on</a> method instead.</p> </dd> </dl> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>listener: <span class="tsd-signature-type">function</span></h5> <div class="tsd-comment tsd-typography"> <p>The listener function.</p> </div> <ul class="tsd-parameters"> <li class="tsd-parameter-siganture"> <ul class="tsd-signatures tsd-kind-type-literal tsd-is-not-exported"> <li class="tsd-signature tsd-kind-icon"><span class="tsd-signature-symbol">(</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4> </li> </ul> </li> </ul> </li> </ul> <h4 class="tsd-returns-title">Returns <a href="scanner.html" class="tsd-signature-type">Scanner</a></h4> <p>The updated <a href="scanner.html">Scanner</a> object.</p> </li> </ul> </section> <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class" > <a name="processimage" class="tsd-anchor"></a> <h3>process<wbr>Image</h3> <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class"> <li class="tsd-signature tsd-kind-icon">process<wbr>Image<span class="tsd-signature-symbol">(</span>imageData<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Uint8ClampedArray</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLImageElement</span>, highQualitySingleFrameMode<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="scanresult.html" class="tsd-signature-type">ScanResult</a><span class="tsd-signature-symbol">&gt;</span></li> </ul> <ul class="tsd-descriptions"> <li class="tsd-description"> <aside class="tsd-sources"> <ul> <li>Defined in lib/scanner.ts:199</li> </ul> </aside> <div class="tsd-comment tsd-typography"> <div class="lead"> <p>Process a given image using the previously set scanner and image settings, recognizing codes and retrieving the result as a list of barcodes (if any).</p> </div> <p>Multiple requests done without waiting for previous results will be queued and handled in order.</p> <p>If <em>highQualitySingleFrameMode</em> is enabled the image will be processed with really accurate internal settings, resulting in much slower but more precise scanning results. This should be used only for single images not part of a continuous video stream.</p> <p>Passing image data as a <em>Uint8ClampedArray</em> is the fastest option, passing a <em>HTMLImageElement</em> will incur in additional operations.</p> <p>Depending on the current image settings, given <em>imageData</em> and scanning execution, any of the following errors could be the rejected result of the returned promise:</p> <ul> <li><code>NoImageSettings</code></li> <li><code>ImageSettingsDataMismatch</code></li> <li><code>ScanditEngineError</code></li> </ul> </div> <h4 class="tsd-parameters-title">Parameters</h4> <ul class="tsd-parameters"> <li> <h5>imageData: <span class="tsd-signature-type">Uint8ClampedArray</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">HTMLImageElement</span></h5> <div class="tsd-comment tsd-typography"> <p>The image data given as byte array or image element, complying with the previously set image settings.</p> </div> </li> <li> <h5><span class="tsd-flag ts-flagDefault value">Default value</span> highQualitySingleFrameMode: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> =&nbsp;false</span></h5> <div class="tsd-comment tsd-typography"> <p>Whether to process the image as a high quality single frame.</p> </div> </li> </ul> <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="scanresult.html" class="tsd-signature-type">ScanResult</a><span class="tsd-signature-symbol">&gt;</span></h4> <p>A promise resolving to the <a href="scanresult.html">ScanResult</a> object.</p> </li> </ul> </section> </section> </div> <div class="col-4 col-menu menu-sticky-wrap menu-highlight"> <nav class="tsd-navigation primary"> <ul> <li class="globals "> <a href="../globals.html"><em>Globals</em></a> </li> </ul> </nav> <nav class="tsd-navigation secondary menu-sticky"> <ul class="before-current"> <li class=" tsd-kind-class"> <a href="barcodepicker.html" class="tsd-kind-icon">Barcode<wbr>Picker</a> </li> <li class=" tsd-kind-class"> <a href="parser.html" class="tsd-kind-icon">Parser</a> </li> <li class=" tsd-kind-class"> <a href="scanresult.html" class="tsd-kind-icon">Scan<wbr>Result</a> </li> <li class=" tsd-kind-class"> <a href="scansettings.html" class="tsd-kind-icon">Scan<wbr>Settings</a> </li> </ul> <ul class="current"> <li class="current tsd-kind-class"> <a href="scanner.html" class="tsd-kind-icon">Scanner</a> <ul> <li class=" tsd-kind-constructor tsd-parent-kind-class"> <a href="scanner.html#constructor" class="tsd-kind-icon">constructor</a> </li> <li class=" tsd-kind-event tsd-parent-kind-class tsd-is-static"> <a href="scanner.html#ready" class="tsd-kind-icon">ready</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#addlistener" class="tsd-kind-icon">add<wbr>Listener</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#applyimagesettings" class="tsd-kind-icon">apply<wbr>Image<wbr>Settings</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#applyscansettings" class="tsd-kind-icon">apply<wbr>Scan<wbr>Settings</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#clearsession" class="tsd-kind-icon">clear<wbr>Session</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#createparserforformat" class="tsd-kind-icon">create<wbr>Parser<wbr>For<wbr>Format</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#destroy" class="tsd-kind-icon">destroy</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#getimagesettings" class="tsd-kind-icon">get<wbr>Image<wbr>Settings</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#getscansettings" class="tsd-kind-icon">get<wbr>Scan<wbr>Settings</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#isbusyprocessing" class="tsd-kind-icon">is<wbr>Busy<wbr>Processing</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#isready" class="tsd-kind-icon">is<wbr>Ready</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#on" class="tsd-kind-icon">on</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#onready" class="tsd-kind-icon">on<wbr>Ready</a> </li> <li class=" tsd-kind-method tsd-parent-kind-class"> <a href="scanner.html#processimage" class="tsd-kind-icon">process<wbr>Image</a> </li> </ul> </li> </ul> <ul class="after-current"> <li class=" tsd-kind-class"> <a href="symbologysettings.html" class="tsd-kind-icon">Symbology<wbr>Settings</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/barcodeencodingrange.html" class="tsd-kind-icon">Barcode<wbr>Encoding<wbr>Range</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/parserfield.html" class="tsd-kind-icon">Parser<wbr>Field</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/parserresult.html" class="tsd-kind-icon">Parser<wbr>Result</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/point.html" class="tsd-kind-icon">Point</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/quadrilateral.html" class="tsd-kind-icon">Quadrilateral</a> </li> <li class=" tsd-kind-interface"> <a href="../interfaces/searcharea.html" class="tsd-kind-icon">Search<wbr>Area</a> </li> <li class=" tsd-kind-variable tsd-is-not-exported"> <a href="../globals.html#resizeobserver" class="tsd-kind-icon">Resize<wbr>Observer</a> </li> <li class=" tsd-kind-function"> <a href="../globals.html#configure" class="tsd-kind-icon">configure</a> </li> </ul> </nav> </div> </div> </div> <footer class="with-border-bottom"> <div class="container"> <h2>Legend</h2> <div class="tsd-legend-group"> <ul class="tsd-legend"> <li class="tsd-kind-module"><span class="tsd-kind-icon">Module</span></li> <li class="tsd-kind-object-literal"><span class="tsd-kind-icon">Object literal</span></li> <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li> <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li> <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li> <li class="tsd-kind-index-signature"><span class="tsd-kind-icon">Index signature</span></li> <li class="tsd-kind-type-alias"><span class="tsd-kind-icon">Type alias</span></li> <li class="tsd-kind-type-alias tsd-has-type-parameter"><span class="tsd-kind-icon">Type alias with type parameter</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-enum"><span class="tsd-kind-icon">Enumeration</span></li> <li class="tsd-kind-enum-member"><span class="tsd-kind-icon">Enumeration member</span></li> <li class="tsd-kind-property tsd-parent-kind-enum"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-enum"><span class="tsd-kind-icon">Method</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li> <li class="tsd-kind-interface tsd-has-type-parameter"><span class="tsd-kind-icon">Interface with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-interface"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-interface"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li> <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li> <li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li> <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class"><span class="tsd-kind-icon">Accessor</span></li> <li class="tsd-kind-index-signature tsd-parent-kind-class"><span class="tsd-kind-icon">Index signature</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-constructor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited constructor</span></li> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private property</span></li> <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li> <li class="tsd-kind-accessor tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private accessor</span></li> </ul> <ul class="tsd-legend"> <li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li> <li class="tsd-kind-call-signature tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li> </ul> </div> </div> </footer> <div class="container tsd-generator"> <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p> </div> <div class="overlay"></div> <script src="../assets/js/main.js"></script> <script>if (location.protocol == 'file:') document.write('<script src="../assets/js/search.js"><' + '/script>');</script> </body> </html>