@phystack/thermal-printer 4.4.51 → 4.4.53
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.
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPeripheralTwinInstance, TwinMessageResult } from '@phystack/hub-client';
|
|
2
2
|
declare const ALIGNMENTS: {
|
|
3
3
|
readonly left: "left";
|
|
4
4
|
readonly center: "center";
|
|
@@ -43,7 +43,7 @@ export interface PrinterPayload {
|
|
|
43
43
|
export declare class ThermalPrinter {
|
|
44
44
|
private operations;
|
|
45
45
|
private peripheral;
|
|
46
|
-
constructor(peripheral:
|
|
46
|
+
constructor(peripheral: IPeripheralTwinInstance);
|
|
47
47
|
/**
|
|
48
48
|
* Add text to be printed
|
|
49
49
|
*/
|
|
@@ -82,6 +82,6 @@ export declare class ThermalPrinter {
|
|
|
82
82
|
/**
|
|
83
83
|
* Print the operations
|
|
84
84
|
*/
|
|
85
|
-
print(): Promise<
|
|
85
|
+
print(): Promise<TwinMessageResult>;
|
|
86
86
|
}
|
|
87
87
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -83,10 +83,11 @@ class ThermalPrinter {
|
|
|
83
83
|
/**
|
|
84
84
|
* Print the operations
|
|
85
85
|
*/
|
|
86
|
-
print() {
|
|
86
|
+
async print() {
|
|
87
87
|
const operations = this.build();
|
|
88
88
|
this.clear();
|
|
89
|
-
|
|
89
|
+
const result = await this.peripheral.emit('PRINT', operations);
|
|
90
|
+
return result;
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
exports.ThermalPrinter = ThermalPrinter;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":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AAI,CAAC;YACnB,IAAI,EAAE,OAAO;YACb,OAAO;YACP,OAAO,EAAC,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE;SAClC,CAAC,CAAA;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IAEH,UAAU,CAAC,OAAwB;QACjC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YACnB,IAAI,EAAE,KAAK;YACX,OAAO;SACR,CAAC,CAAA;QACF,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK;QACH,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,UAAU;SAC5B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAnGD,wCAmGC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phystack/thermal-printer",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.53",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
]
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@phystack/hub-client": "4.4.
|
|
23
|
+
"@phystack/hub-client": "4.4.53"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "^14.0.13",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"ts-node-dev": "^1.0.0-pre.49",
|
|
30
30
|
"typescript": "^5.4.5"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "a4f7403c83ff09fc1a7018a04dbce4ae5062d239"
|
|
33
33
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPeripheralTwinInstance, TwinMessageResult } from '@phystack/hub-client';
|
|
2
2
|
|
|
3
3
|
const ALIGNMENTS = {
|
|
4
4
|
'left': 'left',
|
|
@@ -47,9 +47,9 @@ export interface PrinterPayload {
|
|
|
47
47
|
|
|
48
48
|
export class ThermalPrinter {
|
|
49
49
|
private operations: PrinterOperation[] = [];
|
|
50
|
-
private peripheral:
|
|
50
|
+
private peripheral: IPeripheralTwinInstance;
|
|
51
51
|
|
|
52
|
-
constructor(peripheral:
|
|
52
|
+
constructor(peripheral: IPeripheralTwinInstance) {
|
|
53
53
|
this.peripheral = peripheral;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -138,9 +138,10 @@ export class ThermalPrinter {
|
|
|
138
138
|
/**
|
|
139
139
|
* Print the operations
|
|
140
140
|
*/
|
|
141
|
-
print(): Promise<
|
|
141
|
+
async print(): Promise<TwinMessageResult> {
|
|
142
142
|
const operations = this.build();
|
|
143
143
|
this.clear();
|
|
144
|
-
|
|
144
|
+
const result = await this.peripheral.emit('PRINT', operations);
|
|
145
|
+
return result;
|
|
145
146
|
}
|
|
146
147
|
}
|