/** * Ext.space.Barcode is an API for scanning barcodes in various encodings. * * The API consists of a single function allowing applications to scan multiple * codes in sequence. The sequence is then decoded, and the decoded data are used to * fulfill the promise returned by the API: * * Ext.space.Barcode.scan().then(function(decodedData) { * // loop through the items in `decodedData` to get each value * }); * */Ext.define("Ext.space.Barcode", { singleton: true, /** * Scan a series of one or more codes. * * @return {Ext.space.Promise} Promise that resolves when the decoded data is all ready */ scan: function(type) { var result = new Ext.space.Promise(); Ext.space.Communicator.send({ command: "Barcode#scan", callbacks: { onSuccess: function(data) { result.fulfill(data); }, onError: function(error) { result.reject(error); } } }); return result; }});