Working version
This commit is contained in:
@ -169,3 +169,29 @@ async function createInternalStickerZPL(options) {
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function getAvailablePrinters() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const devices = [];
|
||||
BrowserPrint.getDefaultDevice("printer", device => {
|
||||
devices.push(device);
|
||||
const defaultDevice = device;
|
||||
|
||||
BrowserPrint.getLocalDevices(deviceList => {
|
||||
//console.log(deviceList)
|
||||
deviceList.printer.forEach(device => {
|
||||
if (!defaultDevice || device.uid != defaultDevice.uid) {
|
||||
devices.push(device);
|
||||
}
|
||||
}, error => {
|
||||
reject("Error getting local devices");
|
||||
}, "printer");
|
||||
resolve(devices);
|
||||
});
|
||||
}, error => {
|
||||
reject(error);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user