label-printer 0.7.3 → 0.7.5
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/README.md +8 -3
- package/dist/index.d.mts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -277,8 +277,15 @@ print/display command sequences.
|
|
|
277
277
|
- **`Printer`**
|
|
278
278
|
- `print(label, sets, gap, copiesPerSet?, direction?, mirror?, gapOffset?)`
|
|
279
279
|
- `display(label, direction?, mirror?)`
|
|
280
|
+
- `getModelname()`
|
|
281
|
+
- `getStatus()`
|
|
282
|
+
- `writeRawString(text)`
|
|
280
283
|
- `close()`
|
|
281
284
|
|
|
285
|
+
- **`PrinterStatus`**
|
|
286
|
+
- String union of possible status values returned by `printer.getStatus()`.
|
|
287
|
+
- Access via `printers.PrinterStatus`.
|
|
288
|
+
|
|
282
289
|
## Notes
|
|
283
290
|
|
|
284
291
|
### Useful units
|
|
@@ -343,6 +350,4 @@ Font notes:
|
|
|
343
350
|
- Make changes on feature branch.
|
|
344
351
|
- Run `pnpm changeset` on feature branch to create change.
|
|
345
352
|
- Merge feature branch into main.
|
|
346
|
-
-
|
|
347
|
-
- PR is automatically created on push, merge it to trigger publish
|
|
348
|
-
- Note: If there are unpublished changes on main and the release fails, it will be run again on the next push to main, no need to start again from the first step
|
|
353
|
+
- Changeset will create a PR, merge it to trigger publish
|
package/dist/index.d.mts
CHANGED
|
@@ -839,6 +839,11 @@ declare abstract class Printer {
|
|
|
839
839
|
* @param command Command to send to the usb
|
|
840
840
|
*/
|
|
841
841
|
writeCommand(command: Command): Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Writes a raw string to the printer
|
|
844
|
+
* @param text String to send to the printer
|
|
845
|
+
*/
|
|
846
|
+
writeRawString(text: string): Promise<void>;
|
|
842
847
|
/**
|
|
843
848
|
* Check if the device is indeed a printer
|
|
844
849
|
* @param device
|
|
@@ -991,8 +996,9 @@ type index_Printer = Printer;
|
|
|
991
996
|
declare const index_Printer: typeof Printer;
|
|
992
997
|
type index_PrinterService = PrinterService;
|
|
993
998
|
declare const index_PrinterService: typeof PrinterService;
|
|
999
|
+
type index_PrinterStatus = PrinterStatus;
|
|
994
1000
|
declare namespace index {
|
|
995
|
-
export { index_Printer as Printer, index_PrinterService as PrinterService };
|
|
1001
|
+
export { index_Printer as Printer, index_PrinterService as PrinterService, type index_PrinterStatus as PrinterStatus };
|
|
996
1002
|
}
|
|
997
1003
|
|
|
998
1004
|
export { index$2 as commands, index$1 as labels, index as printers };
|
package/dist/index.d.ts
CHANGED
|
@@ -839,6 +839,11 @@ declare abstract class Printer {
|
|
|
839
839
|
* @param command Command to send to the usb
|
|
840
840
|
*/
|
|
841
841
|
writeCommand(command: Command): Promise<void>;
|
|
842
|
+
/**
|
|
843
|
+
* Writes a raw string to the printer
|
|
844
|
+
* @param text String to send to the printer
|
|
845
|
+
*/
|
|
846
|
+
writeRawString(text: string): Promise<void>;
|
|
842
847
|
/**
|
|
843
848
|
* Check if the device is indeed a printer
|
|
844
849
|
* @param device
|
|
@@ -991,8 +996,9 @@ type index_Printer = Printer;
|
|
|
991
996
|
declare const index_Printer: typeof Printer;
|
|
992
997
|
type index_PrinterService = PrinterService;
|
|
993
998
|
declare const index_PrinterService: typeof PrinterService;
|
|
999
|
+
type index_PrinterStatus = PrinterStatus;
|
|
994
1000
|
declare namespace index {
|
|
995
|
-
export { index_Printer as Printer, index_PrinterService as PrinterService };
|
|
1001
|
+
export { index_Printer as Printer, index_PrinterService as PrinterService, type index_PrinterStatus as PrinterStatus };
|
|
996
1002
|
}
|
|
997
1003
|
|
|
998
1004
|
export { index$2 as commands, index$1 as labels, index as printers };
|
package/dist/index.js
CHANGED
|
@@ -1373,6 +1373,16 @@ var Printer = class {
|
|
|
1373
1373
|
yield command.writeTo(this.device);
|
|
1374
1374
|
});
|
|
1375
1375
|
}
|
|
1376
|
+
/**
|
|
1377
|
+
* Writes a raw string to the printer
|
|
1378
|
+
* @param text String to send to the printer
|
|
1379
|
+
*/
|
|
1380
|
+
writeRawString(text) {
|
|
1381
|
+
return __async(this, null, function* () {
|
|
1382
|
+
if (!this.device.opened) yield this.device.openAndConfigure();
|
|
1383
|
+
yield this.device.writeString(text);
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1376
1386
|
/**
|
|
1377
1387
|
* Check if the device is indeed a printer
|
|
1378
1388
|
* @param device
|