capacitor-zebra-printer
Version:
Capacitor plugin to send ZPL messages to Zebra printers
24 lines • 732 B
JavaScript
import { WebPlugin } from '@capacitor/core';
import fetchWithTimeout from './utils/fetchWithTimeout';
export class CapacitorZebraPrinterWeb extends WebPlugin {
async echo(options) {
console.log('ECHO', options);
return options;
}
async print(options) {
const request = new Request(`http://${options.ip}:${options.port}`, {
method: 'POST',
mode: 'no-cors',
cache: 'no-cache',
body: options.zpl,
});
return await fetchWithTimeout(request)
.then(() => {
return { value: 'success' };
})
.catch(() => {
return { value: 'error' };
});
}
}
//# sourceMappingURL=web.js.map