41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
|
|
import { WebPlugin } from '@capacitor/core';
|
||
|
|
import type {
|
||
|
|
PrinterPlugin,
|
||
|
|
PrinterDevice,
|
||
|
|
BluetoothPrintOptions,
|
||
|
|
NetworkPrintOptions,
|
||
|
|
UsbPrintOptions,
|
||
|
|
PermissionResult
|
||
|
|
} from './definitions';
|
||
|
|
|
||
|
|
export class PrinterWeb extends WebPlugin implements PrinterPlugin {
|
||
|
|
async scanBluetooth(): Promise<{ devices: PrinterDevice[] }> {
|
||
|
|
console.warn('Bluetooth not available on web');
|
||
|
|
return { devices: [] };
|
||
|
|
}
|
||
|
|
|
||
|
|
async scanUsb(): Promise<{ devices: PrinterDevice[] }> {
|
||
|
|
console.warn('USB not available on web');
|
||
|
|
return { devices: [] };
|
||
|
|
}
|
||
|
|
|
||
|
|
async printBluetooth(_options: BluetoothPrintOptions): Promise<{ success: boolean }> {
|
||
|
|
console.warn('Bluetooth printing not available on web');
|
||
|
|
return { success: false };
|
||
|
|
}
|
||
|
|
|
||
|
|
async printNetwork(_options: NetworkPrintOptions): Promise<{ success: boolean }> {
|
||
|
|
console.warn('Network printing not available on web');
|
||
|
|
return { success: false };
|
||
|
|
}
|
||
|
|
|
||
|
|
async printUsb(_options: UsbPrintOptions): Promise<{ success: boolean }> {
|
||
|
|
console.warn('USB printing not available on web');
|
||
|
|
return { success: false };
|
||
|
|
}
|
||
|
|
|
||
|
|
async requestPermissions(): Promise<PermissionResult> {
|
||
|
|
return { bluetooth: 'granted', network: 'granted' };
|
||
|
|
}
|
||
|
|
}
|