Scandit.Ui.Webview

Methods

(static) attachBarcodeScanner(scanner: Scandit.BarcodeScanner, selector?: string)

Enables barcode scanner on the input fields matching given query selector

Parameters:
Name Type Attributes Default Description
scanner Scandit.BarcodeScanner

Barcode scanner instance

selector string <optional>
'.barcode'

CSS selector for input fields which should allow to use barcode scanner, can contain multiple selectors separated by commas

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.attachBarcodeScanner(scanner, '.product-sku');
Scandit.Ui.Webview.attachBarcodeScanner(scanner, '.product-sku');

(static) evaluateJavascript(code: string)

Evaluates JavaScript code inside the website context

Parameters:
Name Type Description
code string

Javascript code

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.evaluateJavascript("alert('test');");
Scandit.Ui.Webview.evaluateJavascript("alert('test');");

(static) load(url: string): Promise

Loads external website into the view

Parameters:
Name Type Description
url string

Request url

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.load("http://scandit.com")
.then(function() {
  // do something when the website fully loaded...
})
.catch(function(reason) {
  // the website couldn't be loaded...
});
Scandit.Ui.Webview.load("http://scandit.com")
.then(() => {
  // do something when the website fully loaded...
})
.catch(reason => {
  // the website couldn't be loaded...
});

(static) on(event: string, callback: function)

Binds callback to an event. Possible events: load, loadError

Parameters:
Name Type Description
event string

Event name

callback function

Event callback

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.on('load', function() {
 // do something when the website is fully loaded...
});
Scandit.Ui.Webview.on('load', () => {
 // do something when the website is fully loaded...
});

Events

load

Load event

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.on('load', function() {
 // do something when the website is fully loaded...
});
Scandit.Ui.Webview.on('load', () => {
 // do something when the website is fully loaded...
});

loadError

Load error event

Examples
  • JavaScript
  • ES6
Scandit.Ui.Webview.on('loadError', function() {
 console.log('Something went wrong with loading the site...');
});
Scandit.Ui.Webview.on('loadError', () => {
 console.log('Something went wrong with loading the site...');
});