-
Couldn't load subscription status.
- Fork 11
Open
Description
Hi, I try to use "esc-pos-encoder-ionic" NPM package in my Ionic project.
When I try to open the page which use the service contains the imported library I have this error:
ERROR Error: Uncaught (in promise): ReferenceError: Cannot access 'HomePageModule' before initialization
ReferenceError: Cannot access 'HomePageModule' before initialization
Related code:
import EscPosEncoder from 'esc-pos-encoder-ionic';
//----
createTicket(){
const encoder = new EscPosEncoder();
const result = encoder.initialize();
result
.align('center')
.newline()
.line('Congratulation, print success')
.line('IP : ' + '192.168.1.1')
.line('Port : ' + '9100')
.newline()
.newline()
.newline()
.newline()
.newline()
.newline()
.cut();
const resultByte = result.encode();
// send byte code into the printer
socket.open(
'192.168.1.1',
'9100',
() => {
socket.write(resultByte, () => {
socket.shutdownWrite();
});
},
(err) => {
console.error(err);
}
);
}
Metadata
Metadata
Assignees
Labels
No labels