naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

ReferenceError: setImmediate is not defined #36

Closed dacostajose closed 4 years ago

dacostajose commented 4 years ago

Hello guys, i try to use the library node-thermal-printer, and i have the error when i try to execute the comand "execute()" from the printer. I was using MobX, with the store and to globally setup the printer, if execute this code with node works.

const printer = new ThermalPrinter({
      type: PrinterTypes.EPSON,
      interface: "/dev/usb/lp0",
      characterSet: "SLOVENIA",
      removeSpecialCharacters: false,
      width: 48,
      lineCharacter: "-"
    });
    console.log("here 3");
    let isConnected = await printer.isPrinterConnected();
    console.log("Printer connected:", isConnected);

    printer.alignCenter();
    printer.println("");
    printer.drawLine();
    printer.println("");
    printer.println("");
    printer.beep();
    printer.cut();
    try {
      await printer.execute();
      console.log("Print success.");
    } catch (error) {
      console.error("Print error:", error);
    }

node version v10.15.3

Any idea, how i fix this?

dacostajose commented 4 years ago

I make work installing the library setimmediate and importing in the index.js.