Closed sKY02644 closed 2 years ago
I got same issue. how to fix it ?
I solved this problem by adding contextIsolation: false in pos-printer.js file line 93.
var mainWindow = new BrowserWindow({ width: 210, height: 1200, show: !!options.preview, webPreferences: { nodeIntegration: true, contextIsolation: false // here } });
Note: this is in the module file not in the main project file.
Working with quasar a vuejs framework PosPrinter retrurn TimedOut error
code in electron main
ipcMain.handle('posPrint', (_event, {data, posoptions}) => { PosPrinter.print(JSON.parse(data), posoptions) .then(() => {}) .catch(err => { console.log(err) }) });
Code in preload
contextBridge.exposeInMainWorld('serivcePrinterPrint', { print_service: (data: { data: PosPrintData, posoptions: PosPrintOptions }) => ipcRenderer.invoke('posPrint', data), })