Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

How to use Global variable inside cordova-sunmi-inner-printer default functions #20

Open
saravanacs opened this issue Sep 25, 2019 · 0 comments

Comments

@saravanacs
Copy link

I'm using cordova-sunmi-inner-print for printing sunmi v1 thermal printer device. More predefined functions here like printerStatusStartListener(), printerInit(),printstring() and so on. My doubt is globally defined variable not using inside predefined function like printerStatusStartListener().

Not alert any messages call and inside printerStatusStartListener() isPrinterValid variable type is 'any'. But, outside function check type is 'boolean'.

So, please suggest how to use global variable inside sunmi-inner-printer function or suggest any other ways

my code is here,

declare var sunmiInnerPrinter: any;
public isPrinterValid:boolean = true; // globally assign true
sunmiInnerPrinter.printerStatusStartListener(function (onSuccess) {
alert("On Success : "+ JSON.stringify(onSuccess))
if (onSuccess != undefined && onSuccess.action == PrinterConstants.NORMAL_ACTION) {
alert("success")
this.isPrinterValid = true; // condition is valid update 'true'
alert("success Value :"+this.isPrinterValid) // not calling alert
}
else {
alert("failure");
this.isPrinterValid = false; // condition is false, update 'false'
alert("failure Value :"+this.isPrinterValid) // not calling alert
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant