Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We should move adapters out of this repository. Then we will be able to use on electorn or web browser. #221

Closed
mofelee opened this issue Aug 13, 2019 · 6 comments

Comments

@mofelee
Copy link

mofelee commented Aug 13, 2019

like this repo: https://github.com/mofelee/escpos-without-adapter

electron network adapter on renderer process:

const net = window.require('net')
@Psychopoulet
Copy link
Collaborator

I think we should optionaly load the adapters, but keep it in the package

@mofelee
Copy link
Author

mofelee commented Aug 18, 2019

I think we should optionaly load the adapters, but keep it in the package

But if adapter's dependency in package.json will cause some problem, like usb or serialport is not woking on electron, but it will try to build those dependencies.

removed from package.json will crash app when dependency missing.

@Psychopoulet
Copy link
Collaborator

with a optional load, there is no problem. the problem only occurs when you use the "require" method, that's why I proposed a dynamic load for usb adapter on the first place.
So, if you keep it in the module but only load it when it's wanted, you will not have this issue in any case, but if you modularize it, it will be called and cause the crash anyway if you put in in the package.json as a dep

@Mwangangi
Copy link

@mofelee Does your fork function well on the browser after removing the adapters? If yes, can it print via USB

@mofelee
Copy link
Author

mofelee commented Oct 28, 2019

@mofelee Does your fork function well on the browser after removing the adapters? If yes, can it print via USB

My printer is network printer, electron can direct use the "net" module on browser. but we need require net module via window.require('net')

@brkrtp
Copy link

brkrtp commented Dec 9, 2019

+1

@lsongdev lsongdev mentioned this issue Feb 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants