escpos-mc 1.0.4-debug → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +18 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12,6 +12,9 @@ const Promiseify = require('./promisify');
12
12
  const statuses = require('./statuses');
13
13
  const {PrinterStatus,OfflineCauseStatus,ErrorCauseStatus,RollPaperSensorStatus, ExternalSensorStatus} = statuses;
14
14
 
15
+ var dontCheckStatus = false;
16
+ var dontCheckTimeout;
17
+
15
18
  /**
16
19
  * [function ESC/POS Printer]
17
20
  * @param {[Adapter]} adapter [eg: usb, network, or serialport]
@@ -107,8 +110,15 @@ Printer.prototype.marginRight = function (size) {
107
110
  * @return {[Printer]} printer [the escpos printer instance]
108
111
  */
109
112
  Printer.prototype.print = function (content) {
113
+ clearTimeout(dontCheckTimeout);
114
+ dontCheckStatus = true;
110
115
  console.log("PRINT_DEBUG", "PRINT_TO_BUFFER", content);
111
116
  this.buffer.write(content);
117
+ dontCheckTimeout = setTimeout(() => {
118
+ dontCheckStatus = false;
119
+ clearTimeout(dontCheckTimeout);
120
+ },50000);
121
+
112
122
  return this;
113
123
  };
114
124
  /**
@@ -960,6 +970,14 @@ Printer.prototype.getStatuses = function(callback) {
960
970
  return this;
961
971
  }
962
972
 
973
+ /**
974
+ * Return dontCheckStatus
975
+ * @return {dontCheckStatus}
976
+ */
977
+ Printer.prototype.getCheckStatus = function () {
978
+ return dontCheckStatus;
979
+ }
980
+
963
981
  /**
964
982
  * get custom statuses from the printer
965
983
  * @param {Function} callback
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "escpos-mc",
3
- "version": "1.0.4-debug",
3
+ "version": "1.0.6",
4
4
  "description": "My temp ESC/POS Printer driver for nodejs",
5
5
  "main": "index.js",
6
6
  "scripts": {